Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Not this way but you could symlink the config into Dropbox which supports rollback. However, MSDOS is not a supported for Dropbox. :) –  Shiki Jun 4 '10 at 13:46
    
Haha, good one! It's indeed an interesting approach (Dropbox), but I can't have Dropbox installed on my work machine. :( –  Somebody still uses you MS-DOS Jun 4 '10 at 14:23
    
Using NTFS's shadow copy? Or some app which monitors for changes and do the job ? (sorry for no 100% answer. :)) –  Shiki Jun 4 '10 at 17:13
    
I would like to have a Vim solution instead of a monitoring solution... The simpler solution I can think of is creating a script that before saving, checks files with the same names and append a number sequence to it. But since I have no experience in vim scritps, it would be difficult to me implement. –  Somebody still uses you MS-DOS Jun 4 '10 at 19:51

3 Answers 3

Use RCS to keep a backup version whenever you save a file : rcsvers.vim http://www.vim.org/scripts/script.php?script_id=563

share|improve this answer
up vote 1 down vote accepted

Simple solution: set your backup drive as a Dropbox folder. It keeps revisions of all your saved files, and you don't need to setup anything.

Another solution: http://vim.wikia.com/wiki/VimTip962

share|improve this answer

Automatically save and diff multiple, sequentially numbered revisions (like VMS) : savevers.vim http://www.vim.org/scripts/script.php?script_id=89

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.