v0.1.2
### Fixed - `BufWritePre` formatters (e.g. conform.nvim format-on-save) now run on autosave. The trigger autocmd now uses `nested = true`, so the `:write` invoked from inside the `InsertLeave` / `TextChanged` / `FocusLost` handler fires nested autocmds (see `:help autocmd-nested`). ### Changed - Skip saves for unmodified, unnamed, or special (`buftype`) buffers instead of always attempting a write. - Drop `:wall` — autosave only writes the buffer the event fired on. - Use `silent` (not `silent!`) so write errors surface instead of being swallowed.
tiny-autosave.nvim
A tiny auto-save plugin for Neovim 0.12+. Saves modified buffers on
InsertLeave and FocusLost.
Zero config. ~15 lines of Lua.
Features
- Auto-saves on leaving insert mode, normal mode changes (undo, paste, etc.), and losing focus
- Only saves normal file buffers (skips special buffers)
- Configurable trigger events
- Works out of the box — no setup call required
Requirements
- Neovim >= 0.12
Installation
Add to your vim.pack.add() call:
"https://github.com/swaits/tiny-autosave.nvim",
Done. The plugin auto-loads with sensible defaults.
Configuration
All options are optional. Call setup() only if you want to customize:
require("tiny-autosave").setup({
events = { "InsertLeave", "TextChanged", "FocusLost" }, -- events that trigger save
})
How it works
On the configured events, the plugin checks if the current buffer is a
normal file buffer (buftype == "") and has unsaved changes. If so, it
runs silent! wall to save all modified buffers.
License
Description
An ultra-minimal autosave plugin for Neovim
44 KiB
0 Stars
1 Watchers
0 Forks
Languages
Lua
89.9%
Shell
10.1%