itchyny/vim-cursorword

assign a color to the underline

Closed this issue · 4 comments

The undersline color changes with the color of words, i.e., if the word is colored by "green", then the underline color is "green" as well. How could I assign a color to underline persistently, like "yellow", no matter what the word color is? Thanks!

You can overwrite the highlight by let g:cursorword_highlight = 0 and then configure highlights of CursorWord0, CursorWord1. Refer to :h undercurll and :h ctermul to use different underline colors.

I tried the following settings without success. Forgot to say I use neovim 0.5 with xfce-terminal.
:h ctermul returns no help in neovim, neither in vim 8.0. When starting neovim, it reports illegal argment "ctermual=red".

let g:cursorword_highlight = 0
:highlight CursorWord0 term=underline cterm=underline gui=underline ctermul=red 
:highlight CursorWord1 term=underline cterm=underline gui=underline ctermul=red

With the following codes, no error but also no underline.

let g:cursorword_highlight = 0
:highlight CursorWord0 term=underline cterm=underline gui=underline guisp=red 
:highlight CursorWord1 term=underline cterm=underline gui=underline guisp=red

The ctermul option was implemented in v8.2.0863. And make sure your terminal supports this non-standard escape code (e.x. printf "\e[4:2;58:5:1mhello\e[0m"). This is not related to this plugin, but to how to configure ctermul in Vim, so closing.

Works with neovim with the followig settings:

highlight CursorWord0 gui=underline guisp=#ebcb8b
highlight CursorWord1 gui=underline guisp=#ebcb8b

from https://stackoverflow.com/a/66816085/349054