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

Fix error message when vim-cursorword is installed #21

Closed brentyi closed 4 years ago

brentyi commented 4 years ago

Hi -- thanks for the great plugin!

I've been getting this error every time I install vim-cursorword: image

This is because highlight groups are currently only added on the VimEnter & Colorscheme events, neither of which will be triggered unless Vim is closed & then re-opened.

Proposing to move the cursorword#highlight call to cursorword#matchadd. Adds a few more clock cycles to the timer callback, but should be insignificant.

itchyny commented 4 years ago

I suggest restarting the editor after installing a plugin. I think it's common to use VimEnter as the trigger of initialization and I don't like to cover this kind of edge cases. This change introduces a highlight check which always succeeds after the setup.

brentyi commented 4 years ago

Understood; thanks!