-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuration for multiple highlighting based on file type. #433
Comments
I have been using this for a while now: " NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\ .*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') added on orignally from: #201 (comment) |
Thanks, this looks like exactly what I needed. I should be putting this anywhere in ~/.vim/syntax/nerdtree.vim right? |
Mine is just in my vimrc |
Thanks again, this seems to be working. Are you using console vim or gvim? For some reason the colours aren't corresponding with what I am setting. |
Help, i'm getting this
It means: event doesn't exist |
Did you make sure to include the function NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) that ryanoasis posted as well? |
Yes, i did |
Ok, i fixed it replacing filetype with FileType, and it's working now :) |
This is pretty great, but is it possible to change the color for folders? |
@ryanoasis your script works great to change the color of files, but for the case of executable files, the script does not change the color of those. Is there any way to get around that? |
I made this if anyone cares: https://github.com/tiagofumo/vim-nerdtree-syntax-highlight |
@tiagofumo is there anyway I can install that with Vundle? |
@marzzz21 I suppose, yeah. I never used vundle but what I made is like a common extension, so it should work. You will need vim-devicons and nerdfonts for the icons. Checkout the description on repo page. |
Thank U! It's useful for me! |
Thanks! Works with Vim 8.1 |
Thx a lot! It is really helpful. |
Parsing |
Similar to the red highlighting on read-only files, it would be nice if you could configure a different colour highlighting based of the file type & extension. If anyone has found a way to do this manually I'd love to hear how.
The text was updated successfully, but these errors were encountered: