itchyny / vim-cursorword

Underlines the word under the cursor
http://www.vim.org/scripts/script.php?script_id=5100
MIT License
611 stars 36 forks source link

assign a color to the underline #31

Closed ccshao closed 3 years ago

ccshao commented 3 years ago

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!

itchyny commented 3 years ago

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.

ccshao commented 3 years ago

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
itchyny commented 3 years ago

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.

ccshao commented 2 years ago

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