add a path filter API

Add an API to allow custom "path filter callbacks" to be added.

Previously we allowed one path filtering function to exist called
`NERDTreeCustomIgnoreFilter`. This has been removed and replaced with an
API to allow any number of such functions to exist -  via the new
`NERDTreeAddPathFilter()`
This commit is contained in:
Martin Grenfell
2015-05-02 22:20:59 +01:00
parent 09e1dbec10
commit 64a9579c11
3 changed files with 25 additions and 4 deletions

View File

@@ -392,6 +392,12 @@ function! s:Path.ignore()
return 1
endif
endfor
for callback in g:NERDTree.PathFilters()
if {callback}({'path': self, 'nerdtree': b:NERDTree})
return 1
endif
endfor
endif
"dont show hidden files unless instructed to
@@ -403,10 +409,6 @@ function! s:Path.ignore()
return 1
endif
if exists("*NERDTreeCustomIgnoreFilter") && NERDTreeCustomIgnoreFilter(self)
return 1
endif
return 0
endfunction