RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.22k stars 51 forks source link

Configurable valid word characters #4

Closed andersevenrud closed 6 years ago

andersevenrud commented 6 years ago

Could it maybe be possible to add configuration for how vim-illuminate recognizes a word ? I was doing some CSS editing and noticed that strings with underscores were completely highlighted, while the hyphens were not (which you find a lot in CSS).

RRethy commented 6 years ago

Check out :h iskeyword and :set iskeyword?. The highlighting is configurable with the iskeyword option.

You can use :set iskeyword+=- which would highlight the whole string with the hyphen. However, I would make sure to use that only for the languages you want to behave like that, maybe use it in an autocmd as such:

autocmd FileType css setlocal iskeyword+=-
andersevenrud commented 6 years ago

I figured it out as soon as you responded to #3. Thanks!