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.

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