tiagofumo / vim-nerdtree-syntax-highlight

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

colors not showing and brackets around icon #23

Open isabelgk opened 6 years ago

isabelgk commented 6 years ago

I installed the plugin using Vundle by adding Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' in my .vimrc. It successfully installed. I also made sure I had the the devicons font installed.

When I open NERDTree, I see:

image

I tried adding in specified colors to see if anything would change, but no luck.

" you can add these colors to your .vimrc to help customizing
let s:brown = "905532"
let s:aqua =  "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'

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

Any idea what I can try?

ipsod commented 5 years ago

I get the same thing in NeoVim, but it works as advertised in Vim and GVim.

hasher-hasher commented 5 years ago

I get the same error that @isabelgk . Somebody have any clue about the issue?

hasher-hasher commented 5 years ago

I figured it out! I just inserted syntax on in my .vimrc file and the colors started to display normally. I'm using ITerm with zshell

reisnobre commented 4 years ago

Yeah, I have the same problem on neovim on Iterm

amuuname commented 4 years ago

I used to have a similar problem where the syntax highlight works for the file/folder names, but not for the icons (pink icons for both directories and any type of files). After digging into the problem for hours, I finally figured out how to solve the problem (sort of). Please refer to https://github.com/ryanoasis/vim-devicons/issues/250#issuecomment-503616655 for the solution. Since I am using NeoVim, I created $HOME/.config/nvim/after/syntax/nerdtree.vim file and added line syntax clear NERDTreeFlags. After restarting the nvim, the devicons are now properly highlighted. However, now I am having ugly brackets around the devicons. ☹️ Hope this helps.

Screen Shot 2020-05-02 at 8 11 57 PM
aborzunov commented 4 years ago

Supplementing @ryanbyon workaround, you can add this command to your .vimrc

augroup nerdtree
    autocmd!
    autocmd FileType nerdtree syntax clear NERDTreeFlags
    " other nerdtree related aucomds
augroup END
timoleistner commented 4 years ago

@ryanbyon's approach gave me the same result with squarebrackets. When I try to add @aborzunov's command to my .vimrc it gives the following error Error detected while processing FileType Autocommands for "nerdtree": E28: No such highlight group name: NERDTreeFlags Im also using NeoVim. In the previously mentioned threat from vim-devicons, there's a solution proposed but this wont work for me neither, maybe because I use NeoVim and not Vim or GVim.

allbombson commented 4 years ago

@ryanbyon's method also gave me the square brackets (Im also using nvim) but they are not misaligned see below: image image Maybe its an issue with your term? try using nvim-qt. On the flip side using @aborzunov's method yielded no results at all! As stated above! I was however able to write my own solution. @timoleistner try autocmd Syntax nerdtree syntax clear NERDTreeFlags after syntax on in your vimrc.

allbombson commented 4 years ago

Here are some screenshots of the output of this: image image

tiagofumo commented 4 years ago

@allbombson, @ryanbyon, @timoleistner update nerdtree, vim-devicons and vim-nerdtree-syntax-highlight to the latest version, undo any syntax clear NERDTreeFlags that you have added anywhere and try again, and check if it works now.

mlwnvncnt commented 4 years ago

Adding this removed the ugly bracket for me, let g:webdevicons_conceal_nerdtree_brackets = o @ryanbyon

alexsmartens commented 3 years ago

I'm having the same problem. My colors are good but these ugly brackets... Screen Shot 2021-08-31 at 4 08 29 PM I tried the above solutions including syntax clear NERDTreeFlags but they did not help.

syntax enable

...

Plug 'ryanoasis/vim-devicons'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'preservim/nerdtree'

syntax clear NERDTreeFlags

...

Any suggestions/ideas?

tiagofumo commented 3 years ago

@alexsmartens have you tried what I mentioned before? Updating vim-devicon, nerdtree and vim-nerdtree-syntax-highlight to the latest versions? You can do that by finding the repo folders on your disk and running "git pull". If you are using Neovim on ubuntu, that would be "~/.config/nvim/bundle/". Also, after doing that you should remove the syntax clear NERDTreeFlags line from your .vimrc and try again.

alexsmartens commented 3 years ago

oh my, thanks @tiagofumo. That solved the problem!

Screen Shot 2021-08-31 at 4 41 34 PM

I thought I'm on the latest versions coz I just installed the plugins. There were a couple of updates to vim-devicon and the other ones were up-to-date.

alexsmartens commented 3 years ago

An interesting thing, the vim that I'm using is a "brew" vim. I installed it as an attempt to solve this problem. After solving the bracket issue with @tiagofumo's suggestion I uninstalled "brew" vim and immediately started seeing the ugly brackets again.

So, I guess something is still off when using the default vim with vim-devicons. At the same time, the "brew" installation of vim plays nice with the brackets although both versions of vim are 8.2.3350 in my case.