autosave.nvim is a Neovim and Vim plugin that provides automatic saving functionality. It allows you to toggle autosave on and off, check the current autosave status, and customize the plugin's behavior.
This plugin requires Vim >= 8.2.3288 with +lua
or Neovim >= 0.9
Using lazy.nvim (recommended) 💤
require("lazy").setup({
{
"brianhuster/autosave.nvim",
event="InsertEnter",
opts = {} -- Configuration here
},
})
rocks.nvim 🪨
:Rocks install live-preview.nvim
vim-plug 🔌
Plug 'brianhuster/autosave.nvim'
Native package (without a plugin manager) 📦
- Neovim
git clone --depth 1 https://github.com/brianhuster/live-preview.nvim ~/.local/share/nvim/site/pack/brianhuster/start/live-preview.nvim
- Vim
git clone --depth 1 https://github.com/brianhuster/live-preview.nvim ~/.vim/pack/brianhuster/start/live-preview.nvim
To enable autosave
:Autosave on
To disable autosave
:Autosave off
To toggle autosave
:Autosave toggle
To check the current autosave status
:Autosave status
" Legacy Vimscript
let g:autosave_enabled = v:true " Enable autosave when the plugin is loaded. Set to v:false to disable autosave, and only enable it when you run the :AutoSave toggle command.
let g:autosave_disable_inside_paths = [] " A list of paths inside which autosave should be disabled.
If you use Lua to configure the plugin, you can use |vim.g| to set these variables.
If you use Neovim, you can run :checkhealth autosave
to check your configuration.
This is likely because your package manager (such as lazy.nvim
) would automatically reload your config when it detects change there. To prevent this, you can disable that behavior of your plugin manager, or just disable autosave when editing your config files.
Using Vimscript:
let g:autosave_disable_inside_paths = [ stdpath('config') ]
Using Lua:
vim.g.autosave_disable_inside_paths = { vim.fn.stdpath('config') }
If you encounter any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on this GitHub repository.