3

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.

5 Answers 5

4

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//
0
2

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.

1

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

0

Hide or completely turn that off?

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

set noswapfile

0

Somebody suggested an autocmd to set the filesystem's "hidden" attribute.

I wrote a plugin to do just that: http://www.vim.org/scripts/script.php?script_id=4505

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .