autowrite.nvim
automatically save buffers on text changes, allowing you to focus on writing while tools receive the latest changes you make to a file
Using lazy.nvim
{
'NitroSniper/autowrite.nvim',
tag = '0.1.0', --locked to current release
opts = {
-- Default Options
-- creates :ToggleAutowrite, :EnableAutowrite, :DisableAutowrite command
create_commands = true,
-- log any info notifications to the user
verbose_info = true,
-- HACK Option: Fix Undo bug that happens on lazy, this is false by default
undo_hack = true,
},
}
I haven't tested it with other package managers but if any bug occurs please send in an issue
If you prefer using mappings instead of commands
vim.keymap.set('n', '<space>aw', require("autowrite").ToggleAutowrite)
ToggleAutowrite
- togglesautowrite
on and off on current bufferEnableAutowrite
- turns onautowrite
on current bufferDisableAutowrite
- turns offautowrite
on current buffer
autowrite.nvim
works on individual buffers whereas 'Autowrite.vim' only works globallyAutowrite.vim
doesn't work well withlazy.nvim
as undo doesn't work correctly,autowrite.nvim
has a hack option which resolves this if you are installing vialazy
autowrite.nvim
has lua functions you can call instead if you don't want to have commands enabled
Features I want to implement in the future if I can
- Implement a global switch alongside working in buffers
- file extensions filtering
- Autowrite.vim - Predecessor of this plugin