xralf
xralf

Reputation: 3662

Automatic saving when making certain number of changes

Is it possible to set in .vimrc that vim saves the file every time I will change (insert, delete, modify) certain number of characters (not after time interval).

I have a bad habit to press :w every time I make some small edit and I'd like to get rid of this bad habit.

thank you

Upvotes: 3

Views: 84

Answers (1)

jamessan
jamessan

Reputation: 42677

In general, you don't have to save with Vim until you're actually done editing or need some external program to be able to see the current state of the file. Vim periodically (both based on time and how much has changed) saves a swap file for the buffer you're editing. So, if Vim or your computer crashes and you haven't saved, you'll still be able to recover a relatively recent version of your file by restoring from the swap file.

Upvotes: 1

Related Questions