diff --git a/.config/nvim/lua/tovi/core/autocmd.lua b/.config/nvim/lua/tovi/core/autocmd.lua index acd8428..1684f10 100644 --- a/.config/nvim/lua/tovi/core/autocmd.lua +++ b/.config/nvim/lua/tovi/core/autocmd.lua @@ -1,7 +1,7 @@ local aucmd_dict = { FileType = { - -- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files { + -- Set tabstop to 2 for Dart, Vue, JavaScript, TypeScript, and JSON files pattern = "dart,vue,javascript,typescript,json", callback = function() vim.opt_local.tabstop = 2 @@ -12,47 +12,65 @@ local aucmd_dict = { }, BufWritePre = { - -- Remove trailing whitespace on save { + -- Remove trailing whitespace on save command = [[%s/\s\+$//e]], }, - -- Run goimports on save { + -- Run goimports on save pattern = "*.go", - command = 'silent! lua require(\'go.format\').goimport()' + callback = function() + require('go.format').goimport() + end, }, }, BufRead = { - -- Return cursor to where it was previously when re-opening a file { + -- Return cursor to where it was previously when re-opening a file command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]] }, - -- Set syntax for Dockerfiles { + -- Set syntax for Dockerfiles pattern = { '*.docker' }, callback = function() vim.opt_local.syntax = 'dockerfile' end - } + }, + + { + pattern = { '*.blade.php' }, + callback = function() + vim.opt_local.syntax = 'html' + end + }, }, BufNewFile = { - -- Set syntax for Dockerfiles { + -- Set syntax for Dockerfiles pattern = { '*.docker' }, callback = function() vim.opt_local.syntax = 'dockerfile' end - } + }, + + { + pattern = { '*.blade.php' }, + callback = function() + vim.opt_local.syntax = 'html' + end + }, }, VimLeave = { - -- Save session on exit { - command = [[mksession! ~/.cache/nvim/session/shutdown_session.vim]] + -- Save session on exit + callback = function() + require('retrospect').SaveSession() + end, }, }, }