autosave.vimvim plugin to autosave buffer when leaving cursor idle |
This is a plugin to auto save the current buffer (if modified) when the cursor is idle.
If you are using vim-plug add this to your plugins list:
Plug 'mjkloeckner/autosave.vim'
Enable autosave for only these filetypes
let g:auto_save_file_types = [ 'markdown' ]
To see all posible filetypes see: https://vi.stackexchange.com/questions/5780/list-known-filetypes
Enable autosave for all filetypes
let g:auto_save_all_filetypes = 0
The event that triggers the autosave is CursorHold and CursorHoldI (see :h CurosrHold). You can change the default wait time to trigger CursorHold with:
set updatetime = 1000 " set updatetime to 1 second (the default is 4)
Note that a very low value may impact Vim performance.