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.

66 lines
1.6 KiB

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