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.

71 lines
1.7 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
  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.cmd("filetype plugin indent on")
  21. vim.cmd("filetype on")
  22. vim.api.nvim_create_autocmd("FileType", {
  23. pattern = "python",
  24. callback = function(args)
  25. vim.bo.textwidth = 0
  26. vim.bo.formatprg = "autopep8"
  27. vim.bo.shiftwidth = 4
  28. vim.bo.tabstop = 4
  29. vim.bo.softtabstop = 4
  30. end
  31. })
  32. vim.api.nvim_create_autocmd("FileType", {
  33. pattern = { "markdown", "tex", "text" },
  34. callback = function(args)
  35. vim.o.smarttab = false
  36. vim.bo.autoindent = false
  37. end
  38. })
  39. vim.api.nvim_create_autocmd("FileType", {
  40. pattern = { "c", "cpp", "slang" },
  41. callback = function(args)
  42. vim.bo.cindent = true
  43. end
  44. })
  45. vim.api.nvim_create_autocmd("FileType", {
  46. pattern = "go",
  47. callback = function(args)
  48. vim.bo.shiftwidth = 4
  49. vim.bo.expandtab = false
  50. vim.bo.tabstop = 4
  51. vim.bo.softtabstop = 4
  52. vim.bo.preserveindent = true
  53. vim.bo.copyindent = true
  54. vim.bo.formatprg = "gofmt -e -w"
  55. vim.api.nvim_set_keymap("n", "<F4>", ":w|:!cpgo test<CR>", { noremap = true })
  56. end
  57. })
  58. vim.api.nvim_create_autocmd("BufWritePre", {
  59. pattern = { "*.go", "*.py", "*.lua", "*.ts", "*.tsx", "*.js", "*.md", "*.json" },
  60. callback = function(args)
  61. vim.lsp.buf.formatting_sync()
  62. end
  63. })