I use this code to highlight:

autocmd CursorMoved * exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\'))

But it fail for <-done in Go:

vim go highlight word under cursor

:verbose set isk returns

        Last set from ~/.vim/vimrc line 225
  • I don't seem to reproduce this issue... What does :verbose set isk? tell you while editing this Go source? Please edit the question to include this information.
    – filbranden
    May 19, 2021 at 6:05
  • @filbranden added May 19, 2021 at 22:43

1 Answer 1


Ooops, I found that in my vimrc I have

"set iskeyword+=\-

I have this for autocompletion of CSS classes like aaa-bbb-ccc.

  • 2
    Do so in a file ~/.vim/ftplugin/css.vim, then it will apply for CSS files only!
    – filbranden
    May 20, 2021 at 1:42
  • 2
    Oh! And in that file make sure you use setlocal, to only affect the current buffer...
    – filbranden
    May 20, 2021 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.