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.

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