git-gutter-vim icon indicating copy to clipboard operation
git-gutter-vim copied to clipboard

Better hi parsing

Open pointlessone opened this issue 12 years ago • 3 comments

Previous code set some expectations on the highlight command output which not always are true. It exptected ctermbg to be exactly 3 chars long and guibg to be exactly 7 chars long. This is not true for many cases. Here's for example my SingColumn:

SignColumn     xxx term=standout ctermfg=11 ctermbg=8 guifg=Cyan guibg=Grey

New code sets a different sets of expectations that might be a bit better. New code relies on the normalized output of highlight command. It parses output and takes the part from "=" to the first space. This should cover the case of varying length of numeric colours as well as named colours.

pointlessone avatar Oct 22 '13 12:10 pointlessone

Thanks!

I merged other pull requset #16 now. The hi parsing is changed to:

let ctermbg_str = matchstr(sign_col, 'ctermbg=\d')

I think I prefer this one. What do you think?

akiomik avatar Oct 23 '13 22:10 akiomik

Indeed, this looks easier. Though, according to documentation ctermbg accepts named colours so it won't work at least for some valid values.

pointlessone avatar Oct 24 '13 08:10 pointlessone

The highlight command accepts named color or indexed color when it set colors, but it shows indexed color when it outputs colors.

:hi Comment ctermbg=Cyan
:hi Comment
" => Comment xxx ctermbg=14

As for ctermbg, I want to let the code of master banch alone. But, as for guibg, it looks like highlight command outputs hex color or named color, so I think your code is better than my code.

:hi Comment guibg=Blue
:hi Comment
" => Comment xxx guibg=Blue

:hi Comment guibg=#0000FF
:hi Comment
" => Comment xxx guibg=#0000FF

In order to merge automatically, can you reset only ctermbg code?

akiomik avatar Oct 24 '13 16:10 akiomik