diff --git a/lua/autocmd.lua b/lua/autocmd.lua index e47fd39..a903e26 100644 --- a/lua/autocmd.lua +++ b/lua/autocmd.lua @@ -21,10 +21,10 @@ vim.api.nvim_create_autocmd('FocusLost', { nested = true, -- Allow other autocommands to run after this one }) -vim.api.nvim_create_autocmd('InsertLeave', { +vim.api.nvim_create_autocmd('BufLeave', { group = autosave_group, pattern = '*', - command = 'silent! wa', -- Save all files when leaving insert mode + command = 'silent! wa', -- Save all files when switching buffers nested = true, -- Allow other autocommands to run after this one })