Last active
January 19, 2017 16:50
-
-
Save scrooloose/17057040c94b6b9786a4 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
"chuck this in ~/.vim/nerdtree_plugin/coffee_filter.vim (see what I did there?) | |
if exists("g:loaded_nerdtree_js_filter") | |
finish | |
endif | |
let g:loaded_nerdtree_js_filter = 1 | |
let s:extMatch = '\.\(js\|js\.map\)$' | |
call g:NERDTree.AddPathFilter("FilterCoffee") | |
"for each '.js' or '.js.map' file, check for the corresponding .coffee file. | |
"If found, ignore this file | |
function! FilterCoffee(params) | |
let path = a:params['path'] | |
if path.isDirectory | |
return | |
endif | |
if path.getLastPathComponent(0) !~ s:extMatch | |
return | |
endif | |
let coffeeFilesInDir = split(globpath(path.getParent().str({'format': 'Glob'}), '*.coffee')) | |
let srcCoffeeFile = substitute(path.str(), s:extMatch, '.coffee', '') | |
return index(coffeeFilesInDir, srcCoffeeFile) != -1 | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment