1 # vim autosave 2 3 This is a plugin to auto save the current buffer (if modified) when the cursor 4 is idle. 5 6 ![autosave2](https://user-images.githubusercontent.com/64109770/235279077-886473b6-ce18-49dd-bdda-7687a58fe4eb.gif) 7 8 ## Installing 9 10 If you are using [vim-plug](https://github.com/junegunn/vim-plug) add this to 11 your plugins list: 12 13 ```vim 14 Plug 'mjkloeckner/autosave.vim' 15 ``` 16 17 ## Options 18 19 - Enable autosave for only these filetypes 20 21 ```vim 22 let g:auto_save_file_types = [ 'markdown' ] 23 ``` 24 25 To see all posible filetypes see: 26 <https://vi.stackexchange.com/questions/5780/list-known-filetypes> 27 28 - Enable autosave for all filetypes 29 ```vim 30 let g:auto_save_all_filetypes = 0 31 ``` 32 33 - The event that triggers the autosave is CursorHold and CursorHoldI (see [:h 34 CurosrHold](https://vimdoc.sourceforge.net/htmldoc/autocmd.html#CursorHold)). 35 You can change the default wait time to trigger CursorHold with: 36 37 ```vim 38 set updatetime = 1000 " set updatetime to 1 second (the default is 4) 39 ``` 40 41 Note that a very low value may impact Vim performance. 42 43 44 ## License 45 46 [MIT](https://opensource.org/licenses/MIT)