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.

48 lines
1.2 KiB

  1. local aucmd_dict = {
  2. FileType = {
  3. {
  4. pattern = "dart,vue,js",
  5. callback = function()
  6. vim.opt_local.tabstop = 2
  7. vim.opt_local.softtabstop = 2
  8. vim.opt_local.shiftwidth = 2
  9. end,
  10. },
  11. },
  12. BufWritePre = {
  13. {
  14. command = [[%s/\s\+$//e]],
  15. },
  16. },
  17. BufRead = {
  18. {
  19. command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
  20. },
  21. {
  22. pattern = { '*.docker' },
  23. callback = function()
  24. vim.opt_local.syntax = 'dockerfile'
  25. end
  26. }
  27. },
  28. BufNewFile = {
  29. {
  30. pattern = { '*.docker' },
  31. callback = function()
  32. vim.opt_local.syntax = 'dockerfile'
  33. end
  34. }
  35. },
  36. VimLeave = {
  37. {
  38. command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]]
  39. },
  40. },
  41. }
  42. for event, opt_tbls in pairs(aucmd_dict) do
  43. for _, opt_tbl in pairs(opt_tbls) do
  44. vim.api.nvim_create_autocmd(event, opt_tbl)
  45. end
  46. end