Files
tiny-autosave.nvim/README.md
T
swaits e95071442b
CI / lint (push) Canceled after 0s
CI / test (push) Canceled after 0s
chore: repoint remaining links at git.swaits.com
Rewrites lingering github.com / *.sr.ht references to this Gitea instance,
translating GitHub and Sourcehut URL shapes to Gitea's (/blob/<ref>/ and
sr.ht /tree/<ref>/item/ -> /src/branch/<ref>/, /tree/<tag> -> /src/tag/<tag>,
/actions/workflows/X -> /actions?workflow=X, /edit/ -> /_edit/).

Left pointing at the old hosts on purpose: pull-request links (PRs were not
migrated), forks that were never migrated, and GitHub-only surfaces Gitea
lacks. OpenPGP identity proofs are untouched by design.
2026-08-31 18:32:25 -06:00

1.0 KiB

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://git.swaits.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

MIT