Created
November 20, 2015 23:15
-
-
Save scrooloose/f832454871d6bcfb52a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"project dir filtering for nerdtree (stick in vimrc) | |
autocmd vimenter * call s:setupPathFilter() | |
function! s:setupPathFilter() abort | |
call NERDTreeAddPathFilter("ProjectPathFilter") | |
let baseDir = "/home/marty/work/playmob/charity_portal/website" | |
let s:proj = { 'root': g:NERDTreePath.New(baseDir) } | |
let s:proj['visibleDirs'] = [ | |
\ g:NERDTreePath.New(baseDir . "/public/system/"), | |
\ g:NERDTreePath.New(baseDir . "/app/views/layouts/") ] | |
endfunction | |
function! ProjectPathFilter(params) abort | |
"bail if not inside the project in question | |
if !a:params['nerdtree'].getRoot().path.equals(s:proj['root']) | |
return 0 | |
endif | |
let p = a:params['path'] | |
for dir in s:proj['visibleDirs'] | |
if p.isUnder(dir) || p.isAncestor(dir) | |
return 0 | |
endif | |
endfor | |
return 1 | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment