Saving backup files automatically in (g)Vim after saving a file.

Posted by Somebody still uses you MS-DOS on Super User See other posts from Super User or by Somebody still uses you MS-DOS
Published on 2010-06-04T13:44:34Z Indexed on 2010/06/07 12:12 UTC
Read the original article Hit count: 165

Filed under:
|
|

I had a problem with my gVim. I lost some important modifications after I plugged on my machine after a hibernating process.

To avoid this kind of problem, I would like to know if it's possible to add something in my .vimrc (or a plugin) that automatically backups all saving made to my files. Disk space is not an issue, I can delete these files after.

I'm already using

set backup
set backupdir=~/.backup/vim
set directory=~/.swap/vim

This creates a myfile.extension~ in my .backup/vim.

...but I would like this configuration to add ~ to first save, ~0 to second, ~1 to third, ~2 to fourth, and so on - something that keeps copies from all modifications I made to a file.

Is this possible? Do you know if there's a plugin for this?

© Super User or respective owner

Related posts about backup

Related posts about gvim