chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

Highlighting hex colors that have a different prefix #63

Closed mklein994 closed 6 years ago

mklein994 commented 6 years ago

I would like to highlight 0xffaa33 the same way as #ffaa33. I'm using Neovim.

Here is a minimal init.vim to reproduce the problem:

" ~/min-init.vim

let g:colorizer_hex_pattern = ['0x', '\x\{6}', '']

call plug#begin($HOME.'/.local/share/nvim/plugged')
Plug 'chrisbra/Colorizer'
call plug#end()

" 0xffaa33

Using this configuration, the comment at the end of the file should be highlighted in an orange color (#ffaa33), but isn't:

nvim -u NONE -u ~/min-init.vim -c ':ColorHighlight' min-init.vim

I tried a few things, and noticed that both of the bottom comments are highlighted as long as the colors are the same, using this configuration:

" ~/min-init.vim

let g:colorizer_hex_pattern = ['\%(0x\|#\)', '\x\{6}', '']

call plug#begin($HOME.'/.local/share/nvim/plugged')
Plug 'chrisbra/Colorizer'
call plug#end()

" 0xffaa33
" #ffaa33
chrisbra commented 6 years ago

thanks for the clear example. I think I fixed it