How to hide gvim's backup files under Windows XP?

EDIT: I think I have mistaken backup files as swap files. Actually I mean the files that end with ~. Sorry.

link|improve this question

73% accept rate
feedback

4 Answers

up vote 3 down vote accepted

I wrote the answer below when the question was about Vim’s swap files. The same idea applies for Vim’s backup files with the option 'backupdir' instead of 'directory' (i.e. use a central directory for the backup files to keep them out of the way).


You could use a central location for the swap files. It would not “flip the hidden bit”, but it would effectively get them out of the way. See the documentation for 'directory'.

Place one of the following in your .vimrc/_vimrc (e.g. :e $HOME/.vimrc):

" Remove the current directory from the list of places that swap files might be created.
set directory-=.

" OR

" Explicit list of locations for swap files.
"   The double trailing slash makes the otherwise centralized swap files use
"   filenames that are based on the full pathname of the edited file
"   (this lets you edit (e.g.) README files from two different places without
"   getting colliding swap file names).
set directory=c:\\tmp//,c:\\temp//
link|improve this answer
Thanks a lot. I'm sorry for the mistake. – Jichao Sep 16 '10 at 5:59
feedback

One way to hide the backup files would be to put them in a separate directory. See

:help backupdir

Another way might be to use the BufWritePost autocommand to set the backup file's hidden attribute after it's written.

link|improve this answer
feedback

To prevent the backup file (the one with the ~ at the end) from being created, add the following to the end of the _vimrc file:

set nobackup

set nowritebackup

link|improve this answer
feedback

Hide or completely turn that off?

If the latter is OK, put to your .vimrc file line

set noswapfile

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.