I'm using the default file browser in Vim a lot. But the annoyance is that it's showing swap files, .orig
, .php~
etc. Can I hide these files somehow?
On a related note, why doesn't Vim always return to the file browser when pushing Ctrl-6?
I'm using the default file browser in Vim a lot. But the annoyance is that it's showing swap files, .orig
, .php~
etc. Can I hide these files somehow?
On a related note, why doesn't Vim always return to the file browser when pushing Ctrl-6?
Most probably this files appears because Vim was closed before the buffer was written to its original file/location. Always enter :write
or :update
before quitting Vim.
Vim lets you define where your backup and swap files reside. It's pretty common to tell Vim to use either a local tmp directory (~/tmp
), or a somewhere else semi-out-of-the-way.
You can define the location using the following commands in your $MYVIMRC
file (typically ~/.vimrc). I use:
set backup " keep a backup file
set backupdir=~/.vim/_backups " store backups here
set directory=~/.vim/_swaps " store swap files here
I've created _backups
and _swaps
in my ~/.vim directory.
Use h directory
and h backupdir
in Vim to read the documentation about the two settings.
Unless you want to move the swap and backup files to another (single) directory (as outlined in the answer of the Tin Man), you have to configure the built-in netrw plugin (which provides the file browser), as described in
:help g:netrw_list_hide
:Put this into your
~/.vimrc
to make it permanent.