Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #61 add optional delay before saving #62

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/auto-save/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Config = {
return false -- can't save
end,
write_all_buffers = false, -- write all buffers when the current one meets `condition`
write_delay = 0, -- the number of milliseconds to wait before saving after receiving a trigger event
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
callbacks = { -- functions to be executed at different intervals
enabling = nil, -- ran when enabling auto-save
Expand Down
2 changes: 1 addition & 1 deletion lua/auto-save/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ end
function M.on()
api.nvim_create_autocmd(cnf.opts.trigger_events, {
callback = function()
perform_save()
vim.defer_fn(perform_save, cnf.opts.write_delay)
end,
pattern = "*",
group = "AutoSave",
Expand Down