Change Vim Swap (.swp) files default path

I work with subversion as a version controller, and I’m a big fan of console. But it’s quite annoying to type a “svn status” and receive lots of question marks on something.swp or .sw0 . Other version control system probably suffer from this issue, unless they have recursive ignore (which, as far as I can tell, svn doesn’t)

Well, I just found Vim Tip #20, which teaches us how to change the folder path for swp files. This way, all swap files for Vim (and, of course, gVim) will be saved on the specified directory.

The comand is :

set directory=/path/to/dir,/path/to/another/dir

There is also “set backupdir=/path/to/dir” to move those something.rb~

Hope this helps you as much as it helped me!

~ by Dante Regis on November 18, 2007.

6 Responses to “Change Vim Swap (.swp) files default path”

  1. Or, you could just set your “global-ignores” variable in ~/.subversion/config file to include “*.swp”. Then subversion would never complain about .swp files ever again. 🙂

  2. Wow, Ben, that’s new for me! Thanks, I’ll take a look!🙂

    Just a question: You wouldn’t be “the” Ben Collins-Sussman, creator of Subversion, would you?

  3. Nice…for some reason set nobackup wasn’t working. I don’t even remember where I saw that. This worked great.

  4. Well, even if you ignore *.swp files the windows-command line could be anoying if you would like to add some files to your repository (I’m useing mercurial and so I have some .hgignore file). So thanks for the hint!

  5. Another reason to do it dante’s way instead of bens way is when you edit remote files. Sometimes I edit files that are on a remote fileserver, and the last thing I want is fetching out to the wan for both the src file and my temp file.

  6. thanks a lot for your tips!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: