Provide autosave functionality to Neovim.
Inspired by vim-auto-save.
use { "mogulla3/autosave.nvim" }
Plug "mogulla3/autosave.nvim"
All you have to do is call the setup()
function.
require('autosave').setup()
Some behaviors are customizable.
-- default settings
require('autosave').setup({
enabled = true,
silent = false,
autosave_events = { "InsertLeave", "TextChanged", "CursorHold" },
postsave_hook = nil,
})
Default: true
If true
, autosave is enabled.
Default: false
If true
, no message is output during autosave.
Default: { "InsertLeave", "TextChanged", "CursorHold" }
Events that perform autosave.
If you want to enable autosave even while in INSERT mode, you may additionally specify CursorHoldI
and CompleteDone
.
See :help events
for more information about events.
Default: nil
Specify the process you want to perform after auto save as a lua function.
Several useful commands are built-in.
Command | Description |
---|---|
:AutosaveEnable |
Enable autosave. |
:AutosaveDisable |
Disable autosave. |
:AutosaveToggle |
Toggle autosave. |