mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2025-12-06 06:36:11 +00:00
@@ -112,6 +112,7 @@ EOF
|
||||
-- if set to `nil` then no specific condition is applied
|
||||
condition = nil,
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
noautocmd = false, -- do not execute autocmds when saving
|
||||
debounce_delay = 1000, -- delay after which a pending save is executed
|
||||
-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
|
||||
debug = false,
|
||||
|
||||
@@ -23,6 +23,7 @@ Config = {
|
||||
--- @type nil|fun(buf: number): boolean
|
||||
condition = nil,
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
noautocmd = false, -- do not execute autocmds when saving
|
||||
debounce_delay = 1000, -- delay after which a pending save is executed
|
||||
-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
|
||||
debug = false, -- print debug messages, set to `true` to enable
|
||||
|
||||
@@ -81,11 +81,12 @@ local function save(buf)
|
||||
|
||||
autocmds.exec_autocmd("AutoSaveWritePre", buf)
|
||||
|
||||
local noautocmd = cnf.opts.noautocmd and "noautocmd " or ""
|
||||
if cnf.opts.write_all_buffers then
|
||||
cmd("silent! wall")
|
||||
cmd(noautocmd .. "silent! wall")
|
||||
else
|
||||
api.nvim_buf_call(buf, function()
|
||||
cmd("silent! write")
|
||||
cmd(noautocmd .. "silent! write")
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user