Question

I found this question, it's very good

Vim NERDTree: show only .txt files?

but, what also need:

dir1/
 -1.cpp
 -1.h
 -1.o
dir2/
dir3/
 -3.txt

show like

dir1/
 -1.cpp
 -1.h
dir2/
dir3/

How can I acheive this purpose?

Was it helpful?

Solution

Thanks for @Kev.

Use scrooloose nerdtree

Instead of Marty Grenfell nerdtree

The latter one doesn't support [[file]] magic flag

"let NERDTreeIgnore = ['^\(.*\.\(cpp\|h\)$\)\@!.*[[file]]']
let NERDTreeIgnore = ['\(\.cpp\|\.h\)\@<!$[[file]]']

Both expresstions work.

You can type: :help pattern.txt and search /@! to see regex syntax detail.

Or there are 2 great links:

regular-expressions look around

Regular expression to match a line that doesn't contain a word?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top