tiagofumo / vim-nerdtree-syntax-highlight

Extra syntax and highlight for nerdtree files
GNU General Public License v3.0
774 stars 42 forks source link

vim-nerdtree-syntax-highlight

This adds syntax for nerdtree on most common file extensions. Whether you want to easily see what is going on in a new project, trying to learn a new framework with a different folder structure, or just trying to make your NERDTree look better, this plugin can help you. This is intended to be used with vim-devicons to add color to icons or entire labels, but will work without it. It is possible to disable highlight, but the syntax will still be available if you want to make something specific with it. The file icons are linked to their labels which are linked to NERDTreeFile, so it will not break anything.

File syntax will follow this pattern:

@ label icon
file extensions nerdtreeFileExtensionLabel_#{extension} nerdtreeFileExtensionIcon_#{extension}
exact match nerdtreeExactMatchLabel_#{name} nerdtreeExactMatchIcon_#{name}
pattern match nerdtreePatternMatchLabel_#{pattern_letters} nerdtreePatternMatchIcon_#{pattern_letters}
unmatched folders WebDevIconsDefaultFolderSymbol set with config from vim-devicons
unmatched files WebDevIconsDefaultFileSymbol set with config from vim-devicons

Screenshots:

Installation:

neobundle.vim :

add this line to your .vimrc or neovim configuration file (usually it is in '~/.config/nvim/init.vim'):

NeoBundle 'tiagofumo/vim-nerdtree-syntax-highlight'

Dependencies

This plugin is intended to be used with vim-devicons and to use it you will need to add a new font from nerd-fonts to your machine so you can see the icons when using vim.

Configuration

let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error let g:NERDTreeExtensionHighlightColor['css'] = s:blue " sets the color of css files to blue

let g:NERDTreeExactMatchHighlightColor = {} " this line is needed to avoid error let g:NERDTreeExactMatchHighlightColor['.gitignore'] = s:git_orange " sets the color for .gitignore files

let g:NERDTreePatternMatchHighlightColor = {} " this line is needed to avoid error let g:NERDTreePatternMatchHighlightColor['.*_spec.rb$'] = s:rspec_red " sets the color for files ending with _spec.rb

let g:WebDevIconsDefaultFolderSymbolColor = s:beige " sets the color for folders that did not match any rule let g:WebDevIconsDefaultFileSymbolColor = s:blue " sets the color for files that did not match any rule


* Disable Highlight for specific file extension
```vim
" If you have vim-devicons you can customize your icons for each file type.
let g:NERDTreeExtensionHighlightColor = {} "this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['css'] = '' "assigning it to an empty string will skip highlight