|
|
-
- local aucmd_dict = {
- FileType = {
- {
- pattern = "dart,vue,javascript,typescript,json",
- callback = function()
- vim.opt_local.tabstop = 2
- vim.opt_local.softtabstop = 2
- vim.opt_local.shiftwidth = 2
- -- vim.bo.tabstop = 2 -- size of a hard tabstop (ts).
- -- vim.bo.shiftwidth = 2 -- size of an indentation (sw).
- -- vim.bo.softtabstop = 2 -- number of spaces a <Tab> counts for. When 0, feature is off (sts).
- end,
- },
- },
-
- BufWritePre = {
- {
- command = [[%s/\s\+$//e]],
- },
- {
- pattern = "*.go",
- command = 'silent! lua require(\'go.format\').goimport()'
- },
- },
-
- BufRead = {
- {
- command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
- },
- {
- pattern = { '*.docker' },
- callback = function()
- vim.opt_local.syntax = 'dockerfile'
- end
- }
- },
-
- BufNewFile = {
- {
- pattern = { '*.docker' },
- callback = function()
- vim.opt_local.syntax = 'dockerfile'
- end
- }
- },
-
- VimLeave = {
- {
- command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]]
- },
- },
- }
-
- for event, opt_tbls in pairs(aucmd_dict) do
- for _, opt_tbl in pairs(opt_tbls) do
- vim.api.nvim_create_autocmd(event, opt_tbl)
- end
- end
|