Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So it appears that the commit c29c2a1 makes the
Hlgroup.new
call get_hex on both fg and bg, but get_hex returns an empty string when we pass a name, likered
. So we cannot set a component like this anymore:Before it just simply passed the value as is to a
vim.cmd('highlight ...')
, so we could use color names without a problem.I think it is nice to able to get the color of a hlgroup, which is what the mentioned commit does, so I think we should definitely keep that. I then started looking at the code and noticed that it looks at the first character passed to fg (or bg) and checks if it is a
#
to decide if the user passed a hlgroup name or a color.After weird workarounds (that included hardcoding some names 馃槄 - not good workarounds) and some googleing around, I found out that vim has a function
hlexists
, which receives a string and returns 0 if a hlgroup with that name does not exist and 1 if it does.So I think we could change the check to use that function instead of looking if the first character of the string is
#
or not.What do you think?