local aucmd_dict = { FileType = { { pattern = "dart,vue,js", callback = function() vim.opt_local.tabstop = 2 vim.opt_local.softtabstop = 2 vim.opt_local.shiftwidth = 2 end, }, }, BufWritePre = { { command = [[%s/\s\+$//e]], }, }, 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