How to filter out files by extension in NERDTree?
Asked Answered
I

2

197

I would like to *.pyc files not to be shown in NERDTree vim plugin.

How to achieve that?

Impenitent answered 8/4, 2011 at 23:26 Comment(0)
M
318

You want the NERDTreeIgnore option. For example, in your .vimrc:

let NERDTreeIgnore = ['\.pyc$']

Where NERDTreeIgnore is an array of regular expressions that match the files you want to exclude.

Mannose answered 8/4, 2011 at 23:40 Comment(5)
This can be comma-separated to include more patterns: ['\.pyc$', '\.png$']Grudging
Full documentation can be found in vim: :help NERDTree or specifically :help NERDTreeIgnoreRondarondeau
What about a path ?Galyak
@Galyak :help NERDTreeIgnoreDefector
The path it's now been marked as a feature request github.com/scrooloose/nerdtree/issues/737Galyak
C
1

Just ran into the problem: What about hiding binary files that do not have an extension?

Can't hide them, but can sort files to eliminate some cheesy clutter. Problem looks like:

file1*
file1.c
file2*
file2.c

Solution:

let NERDTreeSortOrder=['\.c$']

Result:

file1.c
file2.c
file1*
file2*

which will sort first the files ending with ".c" (followed by some other extension if you want). You don't get rid of the binary files, but it becomes manageable.

NERDTree has a mechanism to detect and highlight files with the extra execute bit, where -rwxr-xr-x displays in bold with a "*" at the end of the filename. It would not be hard to add an extra mechanism to hide executable files (useful for compiled stuff, not so desirable for scripts).

Contracted answered 18/4, 2018 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.