Monday, January 28, 2008

Back It Up

This has saved my ass enough times that I feel compelled to mention it.

You can have Vim make a backup copy of any file you save right before overwriting it by adding the following to your .vimrc.

set backup " enable backups
set backupdir=/your/homedir/.vim/backup " where to put backup file

I set my tempfile directory for good measure.

set directory=/your/homedir/.vim/temp " new temp dir

Note: you will need to create the directories inside .vim before this will work.

No comments: