Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic saving when making certain number of changes

Tags:

vim

save

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

like image 633
xralf Avatar asked Apr 14 '26 21:04

xralf


1 Answers

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.

like image 199
jamessan Avatar answered Apr 17 '26 15:04

jamessan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!