commit 76dbc0c8eee86df041c6c97b2bd1ea4f266d0054
parent da3874cf933e3736f9a8d1a2cfe35943d88fa94b
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date: Wed, 6 May 2015 20:58:55 +0100
Merge branch 'add_path_filter_api'
Diffstat:
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/lib/nerdtree/nerdtree.vim b/lib/nerdtree/nerdtree.vim
@@ -3,6 +3,11 @@
let s:NERDTree = {}
let g:NERDTree = s:NERDTree
+"FUNCTION: s:NERDTree.AddPathFilter() {{{1
+function! s:NERDTree.AddPathFilter(callback)
+ call add(s:NERDTree.PathFilters(), a:callback)
+endfunction
+
"FUNCTION: s:NERDTree.Close() {{{1
"Closes the primary NERD tree window for this tab
function! s:NERDTree.Close()
@@ -116,6 +121,15 @@ function! s:NERDTree.New(path)
return newObj
endfunction
+"FUNCTION: s:NERDTree.PathFilters() {{{1
+function! s:NERDTree.PathFilters()
+ if !exists('s:NERDTree._PathFilters')
+ let s:NERDTree._PathFilters = []
+ endif
+ return s:NERDTree._PathFilters
+endfunction
+
+
"FUNCTION: s:NERDTree.render() {{{1
"A convenience function - since this is called often
function! s:NERDTree.render()
diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
@@ -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
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -196,6 +196,11 @@ function! NERDTreeCWD()
call NERDTreeFocus()
call nerdtree#ui_glue#chRootCwd()
endfunction
+
+function! NERDTreeAddPathFilter(callback)
+ call g:NERDTree.AddPathFilter(a:callback)
+endfunction
+
" SECTION: Post Source Actions {{{1
call nerdtree#postSourceActions()