Search code examples
vimfile-browser

Hiding swp, ~ files in the default Vim file browser


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?


Solution

  • 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:

    :let g:netrw_list_hide= '.*\.swp$,\~$,\.orig$'
    

    Put this into your ~/.vimrc to make it permanent.