Neovim configs for 2023. Hopefully they last.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.0 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. vim.opt.mouse:append('a')
  2. vim.opt.number = true
  3. vim.opt.linebreak = true
  4. vim.opt.shiftwidth = 2
  5. vim.opt.tabstop = 2
  6. vim.opt.softtabstop = 2
  7. vim.opt.expandtab = true
  8. vim.opt.smarttab = true
  9. vim.opt.shiftround = true
  10. vim.opt.autoindent = true
  11. vim.opt.textwidth = 80
  12. vim.opt.colorcolumn = "80"
  13. vim.opt.list = true
  14. vim.opt.wrap = false
  15. vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
  16. vim.opt.undofile = true
  17. vim.opt.hlsearch = false
  18. vim.opt.incsearch = true
  19. vim.g.airline_theme = "base16_chalk"
  20. vim.g.airline_powerline_fonts = 1
  21. vim.opt.nu = true
  22. vim.opt.rnu = true
  23. vim.opt.scrolloff = 7
  24. vim.cmd("filetype plugin indent on")
  25. vim.cmd("filetype on")
  26. vim.api.nvim_create_autocmd("FileType", {
  27. pattern = "python",
  28. callback = function(args)
  29. vim.bo.textwidth = 0
  30. vim.bo.formatprg = "autopep8"
  31. vim.bo.shiftwidth = 4
  32. vim.bo.tabstop = 4
  33. vim.bo.softtabstop = 4
  34. end
  35. })
  36. vim.api.nvim_create_autocmd("FileType", {
  37. pattern = { "tex", "text" },
  38. callback = function(args)
  39. vim.o.smarttab = false
  40. vim.bo.autoindent = false
  41. end
  42. })
  43. vim.api.nvim_create_autocmd("FileType", {
  44. pattern = { "c", "cpp", "slang" },
  45. callback = function(args)
  46. vim.bo.cindent = true
  47. end
  48. })
  49. vim.api.nvim_create_autocmd("FileType", {
  50. pattern = "markdown",
  51. callback = function(args)
  52. vim.bo.shiftwidth = 4
  53. vim.bo.tabstop = 4
  54. vim.bo.softtabstop = 4
  55. vim.bo.autoindent = true
  56. end
  57. })
  58. vim.api.nvim_create_autocmd("FileType", {
  59. pattern = "go",
  60. callback = function(args)
  61. vim.bo.shiftwidth = 4
  62. vim.bo.expandtab = false
  63. vim.bo.tabstop = 4
  64. vim.bo.softtabstop = 4
  65. vim.bo.preserveindent = true
  66. vim.bo.copyindent = true
  67. vim.bo.formatprg = "gofmt -e -w"
  68. vim.api.nvim_set_keymap("n", "<F4>", ":w|:!cpgo test<CR>", { noremap = true })
  69. end
  70. })
  71. vim.api.nvim_create_autocmd("BufWritePre", {
  72. pattern = { "*.go", "*.py", "*.lua", "*.ts", "*.tsx", "*.js", "*.md", "*.json", "*.rs" },
  73. callback = function(args)
  74. vim.lsp.buf.formatting_sync()
  75. end
  76. })