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.

76 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.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 = "go",
  50. callback = function(args)
  51. vim.bo.shiftwidth = 4
  52. vim.bo.expandtab = false
  53. vim.bo.tabstop = 4
  54. vim.bo.softtabstop = 4
  55. vim.bo.preserveindent = true
  56. vim.bo.copyindent = true
  57. vim.bo.formatprg = "gofmt -e -w"
  58. vim.api.nvim_set_keymap("n", "<F4>", ":w|:!cpgo test<CR>", { noremap = true })
  59. end
  60. })
  61. vim.api.nvim_create_autocmd("BufWritePre", {
  62. pattern = { "*.go", "*.py", "*.lua", "*.ts", "*.tsx", "*.js", "*.md", "*.json" },
  63. callback = function(args)
  64. vim.lsp.buf.formatting_sync()
  65. end
  66. })