I use this plugin for autosaving in nvim. This works well.
You can add these lines in your plugin config file for auto saving in normal mode and after text change event.
{
enabled = true,
execution_message = {
message = function()
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18,
},
trigger_events = {"InsertLeave", "TextChanged"},
condition = function(buf)
local fn = vim.fn
local utils = require("auto-save.utils.data")
if
fn.getbufvar(buf, "&modifiable") == 1 and
utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
return true
end
return false
end,
write_all_buffers = false,
debounce_delay = 135,
callbacks = {
enabling = nil,
disabling = nil,
before_asserting_save = nil,
before_saving = nil,
after_saving = nil,
}
}
这是本金的缺省组合,认为 yourself是你想要的。