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.

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