On Mon, Jan 26, 2015 11:03:25 AM, Paul wrote:
>On Fr, 23 Jan 2015, Paul wrote:
>> Christian Brabandt kindly donated a function "Hi" to save the
>> highlighting for a group (included at the very bottom).
>>
>> <...snip...>
>>
>> I have groups for which not all keys are defined. They are saved
>> with a value of -1, which seems to be interpretted as an error:
>>
>> :echo Hi("CursorLine")
>> hi CursorLine term=underline ctermbg=-1 ctermfg=-1 guibg=#002000 cterm=underline guifg=white
>>
>> :exe Hi("CursorLine")
>> E421: Color name or number not recognized: ctermbg=-1 ctermfg=-1 guibg=#002000 cterm=underline guifg=white
>>
>> I've delved into vim code in years past, and I have an idea of how
>> long it will take. Unfortunately, I won't be doing that any time
>> soon. Is there a quick way to get around the problem? <...snip...>
>
>Christian replied:
>>>
>>> let out='hi ' . a:1
>>> for item in items(s:attr)
>>> "if item[1] >=0
>>> let out .= printf(" %s=%s", item[0], item[1])
>>> "endif
>>> endfor
>>
>> Try uncommenting the above if statement.
>
> It works awesomely, Christian. Thanks! Code below, for posterity
> (future usenet archivers in years to come). Unfortunately, I cannot
> upload, so the wrap-around below will turn the code into a dog's
> breakfast.
By the way, is vimfiles/plugin a good place to put this?
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment