Skip to content

Commit 856204f

Browse files
committed
Add limited extension highlight option
1 parent 203e916 commit 856204f

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

after/syntax/nerdtree.vim

+41-1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,44 @@ let s:file_node_pattern_matches = {
340340
\ '.*mootools.*\.js$' : s:white
341341
\}
342342

343+
let s:enabled_extensions = [
344+
\ 'bat',
345+
\ 'bmp',
346+
\ 'c',
347+
\ 'c',
348+
\ 'coffee',
349+
\ 'cpp',
350+
\ 'css',
351+
\ 'erb',
352+
\ 'go',
353+
\ 'html',
354+
\ 'java',
355+
\ 'jpg',
356+
\ 'js',
357+
\ 'json',
358+
\ 'jsx',
359+
\ 'lua',
360+
\ 'markdown',
361+
\ 'md',
362+
\ 'php',
363+
\ 'png',
364+
\ 'py',
365+
\ 'rb',
366+
\ 'scala',
367+
\ 'scss',
368+
\ 'sh',
369+
\ 'sql',
370+
\ 'vim',
371+
\]
372+
373+
if !exists('g:NERDTreeSyntaxEnabledExtensions')
374+
let g:NERDTreeSyntaxEnabledExtensions = []
375+
endif
376+
377+
for extension in s:enabled_extensions
378+
call add(g:NERDTreeSyntaxEnabledExtensions, extension)
379+
endfor
380+
343381
let s:characters = '[a-zA-Z0-9_\#\-\+\*\%\!\~\(\)\{\}\&\.\$\@]'
344382

345383
" Extension colors
@@ -349,7 +387,9 @@ if !exists('g:NERDTreeExtensionHighlightColor')
349387
endif
350388

351389
for [key, val] in items(s:file_extension_colors)
352-
if !has_key(g:NERDTreeExtensionHighlightColor , key)
390+
if !has_key(g:NERDTreeExtensionHighlightColor , key) &&
391+
\ (!exists('g:NERDTreeLimitedSyntax') ||
392+
\ index(g:NERDTreeSyntaxEnabledExtensions, key) >= 0)
353393
let g:NERDTreeExtensionHighlightColor[key] = val
354394
endif
355395
endfor

0 commit comments

Comments
 (0)