Skip to content
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

Better hi parsing #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pointlessone
Copy link

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.

@akiomik
Copy link
Owner

akiomik commented Oct 23, 2013

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?

@pointlessone
Copy link
Author

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

@akiomik
Copy link
Owner

akiomik commented Oct 24, 2013

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?

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants