Skip to content

A simple Neovim and Vim plugin for autosaving as you type

License

Notifications You must be signed in to change notification settings

brianhuster/autosave.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autosave.nvim

LuaRocks

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.

Installation

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

Usage

To enable autosave

:Autosave on

To disable autosave

:Autosave off

To toggle autosave

:Autosave toggle

To check the current autosave status

:Autosave status

Configuration

" 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.

FAQ

When editing Neovim config files, a message saying "Config changed" keeps appearing.

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') }

Contributing

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.

About

A simple Neovim and Vim plugin for autosaving as you type

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published