A Quick Note: Avoiding Those Pesky vim Backup Files

Mac OS X    2012-09-27

I use vi in the OS X terminal pretty much exclusively. A few weeks ago I did something to blow away my original .vimrc file - I have no idea how I did that, which is a little scary. One of the results was that vi automatically started creating backup files (a saved copy of the original file with a tilde after the file extension, created whenever you make a change), e.g., somefile.txt (current version) and somefile.txt~ (the backup).

To stop all this unnecessary file creation, pop open your ~/.vimrc and add the following lines:

set nobackup
set nowritebackup

Note: For this to work, you'll need to delete or comment out any other lines referring to setting backup, e.g.:

" if has("vms")
"   set nobackup       " do not keep a backup file, use versions instead
" else
"   set backup          " keep a backup file
" endif