vim backup files - how to move

vim FAQ: How do I move vim backup files to another directory? (Those files that end with the "~" character.)

To move vim backup files to another directory, just use commands like these in your "vimrc" configuration file:

" tell vim to keep a backup file
set backup

" tell vim where to put its backup files
set backupdir=/private/tmp

" tell vim where to put swap files
set dir=/private/tmp

On Unix, Linux, and Mac OS X systems, just place these commands in the .vimrc file in your home directory, and these vim backup files will be moved to the directory you specify. If you're using an older version of vi, you should place these commands in a file named .exrc in your home directory.

For more details on vim backup files, see my vim temporary and backup files tutorial.

 

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.