Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Wednesday, November 6, 2013

Basic Recovery

The following commands are useful for recovering an editing session.

Retrieve a list of recoverable files.
vim -r
Recover a specific file.
vim -r .file.extension.swp (from swap files listed above)
Recover an unnamed (unsaved) file.
vim -r .swp
Or from inside of Vim:
:recover .file.extension.swp

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.