itchyny/vim-cursorword

Words with multi-byte characters ignored

Closed this issue · 6 comments

jceb commented

In this line there is a comparison between byte length and the number of characters. Words containing multi-byte characters are therefore ignored by cursorword.
https://github.com/itchyny/vim-cursorword/blob/master/autoload/cursorword.vim#L32

Why is this check in place? Can't the plugin rely solely on the iskeyword setting?

In short, in order to disable highlight in Japanese. In Japanese, most of the characters matches \k and there's no spaces between the words so whole the sentences are underlined without that check. Which character do you expect to be underlined?

jceb commented

In German we have öäüß, in French there are all the accents.

How about making this setting configurable?

Hmm, can I test by comparing len(word) and strdisplaywidth(word)?

jceb commented

Actually, that doesn't help much. How about adding a configuration option so this comparison can be disabled?

@jceb, I stumbled upon the same issue. vim_current_word does what we want.

You might want to add this to your .vimrc to get the same highlights as vim-cursorword:

hi CurrentWord cterm=underline gui=underline
jceb commented

@ericbn thanks. I started using https://github.com/osyo-manga/vim-brightest in the meantime.