2

I'm trying to hide Python's __pycache__ directories in Vim's Netrw by setting:

:let g:netrw_list_hide = '^__pycache__$'

The value of this variable is supposed to be a regexp, yet the above pattern doesn't hide the __pycache__ directories. Setting it to the more simple:

:let g:netrw_list_hide = '__pycache__'

Does work, but then it over-matches to any path that contains this substring anywhere, so for example __pycache__foo will be ignored too.

Any idea why the first matching pattern doesn't work?

Dun Peal
  • 16,679
  • 11
  • 33
  • 46

2 Answers2

2

Try :let g:netrw_list_hide = '__pycache__/'

user21497
  • 1,061
  • 8
  • 9
0

You can use netrw_gitignore#Hide() function, which will hide all files inside your .gitignore file.

Here is how I have used the function with g:netrw_list_hide in my vimrc.

 let g:netrw_list_hide = netrw_gitignore#Hide()

You may have to reload your vim or source your config for this to work.

For more info about netrw_list_hide and netrw_gitignore just type

:h netrw_list_hide and :h netrw_gitignore

in vim command line mode to see the manual

Cheers

Josiah Nyarega
  • 595
  • 1
  • 8
  • 11