git-gutter-vim
git-gutter-vim copied to clipboard
Better hi parsing
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.
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?
Indeed, this looks easier. Though, according to documentation ctermbg accepts named colours so it won't work at least for some valid values.
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?