I am new to vim and was wondering if there is a way for files that have already been manually saved to be automatically saved (every few seconds). I currently make a lot of new files (for testing plugins, etc.) that I don't want to keep, and so I want this function to only apply to files I have already manually saved at least once. Thank you!
Modified 4 years, 2 months ago
Viewed 80 times
- Every time you save, you add buffer number to a global set, it can be done with autocmd with BufWritePost event or custom save command.
- Write a function to go through all the buffers that have been saved, save it again if &modified is true.
- Add an autocmd with CursorHold event and your function.
Instead of a save command, why not autocmd for BufWritePost ?– D. Ben Knoble ♦Mar 28, 2019 at 1:11
Good point :) .– dedowsdiMar 28, 2019 at 1:27