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
- Vimscript
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.
g:autosave_disable_inside_paths = [] " A list of paths inside which autosave should be disabled. In Neovim, it is recommended to set this to [stdpath('config')] to disable autosave for files inside your Neovim configuration directory, so that Neovim doesn't reload whenever you type inside your configuration files.
- Lua (only available in Neovim)
require("autosave").setup({
enabled = true, -- Enable autosave when the plugin is loaded. Set to false to disable autosave, and only enable it when you run the :AutoSave toggle command.
disable_inside_paths = {}, -- A list of paths inside which autosave should be disabled. In Neovim, it is recommended to set this to {vim.fn.stdpath('config')} to disable autosave for files inside your Neovim configuration directory, so that Neovim doesn't reload whenever you type inside your configuration files.
})
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.