As the question title mentions. I'm looking to automatically get the file saved as I type in VIM (insert mode).
Is this possible? How to achieve it?
As the question title mentions. I'm looking to automatically get the file saved as I type in VIM (insert mode).
Is this possible? How to achieve it?
You can use AutoSave plugin to perform that:
https://github.com/907th/vim-auto-save
Please notice that AutoSave is disabled by default, run
:AutoSaveToggle
to enable/disable it.There is no native support for auto-saving in Vim. But you can use vim-auto-save plugin to perform that.
This plugin auto-saves in normal mode only by default, but there is a section in it's README which describes how to configure the plugin to save in insert mode too. Hint: you should configure the plugin to auto-save on
CursorHoldI
and/orTextChangedI
Vim events.Please, refer to the plugin documentation on how to install and use it.
I recommend to save the buffer whenever text is changed:
I found it here. It works for me.
Don't know if someone mentioned this. Autosave Per File Type
( in this case it is for a Markdown *.md file)
This will write the contents of the file the moment they are modified but only for Markdown (*.md) files.
This will handle read-only buffers (like netrw) and undetected filetypes. Using TextChangedI instead of InsertLeave seems to cause a write for every character typed in insert mode, which may or may not be what you want.
907th/vim-auto-save auto saves file. But if your .vimrc depends on write event, then it could have issue.
Recently, I notice https://github.com/chrisbra/vim-autosave, which saves files to a backup dir, which sounds promising if your .vimrc depends on write event.