HOWTO: Configure VI To Stop Saving Annoying ~ (Tilde) Backup Files

I like Vi, but I hate the fact that it saves these really annoying backup files when I'm working.  For example, if I'm working on "index.php", once I :w the file (that's save the file for non-Vi users), it will also spit out "index.php~".  According to Vim documentation, the file with a tilde on the end of it is supposed to be a backup copy of the previous revision before the save.  I suppose this is a nice feature, but I don't use Vim enough (anymore) to take advantage of it.  The files with the tilde's on the end of them get plain annoying after a while.

The solution is to :set nobk in your Vim session.  Or, if you don't want to :set nobk for every new session (like me), you can edit your .vimrc/.gvimrc files.  Continue reading where to find your .vimrc and .gvimrc files on Vista and Linux.
On Linux, your .gvimrc and .vimrc files can be found in your home directory:

#/> ll ~ -a | grep vim | grep rc
-rw-rw-r--  1 mark mark    22 2008-04-08 09:18 .gvimrc
-rw-rw-r--  1 mark mark    22 2008-04-08 09:19 .vimrc


On Vista/XP, assuming you have the Windows version of Vim installed, you can find the _vimrc config file at C:\Program Files\Vim\_vimrc.

Add "set nobk" to your Vim configuration file as shown below.  Enjoy.

vimrc.png

Did You Find this Helpful?

Did you find this post helpful, or at least, interesting?

  

About Mark

A Silicon Valley native, Mark Kolich is a full-time Software Engineer and a consultant for hire. A web technologies expert, his current focus is on building powerful and robust cloud-driven web-applications using Java, PHP, Perl, AJAX, DHTML, CSS, and JavaScript. His favorite programming languages are PHP, Java and JavaScript. He uses Linux, enjoys biking to work, loves building great software, and always writes elegant, readable, and maintainable code.

Twitter (@markkolich)

Translate

About this Entry

This page contains a single entry by Mark Kolich published on October 27, 2008 4:00 PM.

HOWTO: export LANG=en_US.ISO-8859-1 to Compile Java (javac) on Linux was the previous entry in this blog.

HOWTO: Use Regex's to Validate Email Addresses and Passwords is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.