Small changes
This commit is contained in:
+7
-9
@@ -14,17 +14,16 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
|
||||
local autosave_group = vim.api.nvim_create_augroup('autosaving', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd('FocusLost', {
|
||||
vim.api.nvim_create_autocmd({ 'FocusLost', 'BufLeave' }, {
|
||||
group = autosave_group,
|
||||
pattern = '*',
|
||||
command = 'silent! wa', -- Save all files when moving away from the window
|
||||
nested = true, -- Allow other autocommands to run after this one
|
||||
})
|
||||
callback = function(args)
|
||||
if vim.bo[args.buf].filetype == 'oil' then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('BufLeave', {
|
||||
group = autosave_group,
|
||||
pattern = '*',
|
||||
command = 'silent! wa', -- Save all files when switching buffers
|
||||
vim.cmd 'silent! wa'
|
||||
end,
|
||||
nested = true, -- Allow other autocommands to run after this one
|
||||
})
|
||||
|
||||
@@ -218,4 +217,3 @@ vim.api.nvim_create_autocmd('VimLeavePre', {
|
||||
})
|
||||
|
||||
require('helpers').edit_cf('a', '/lua/autocmd.lua')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user