azabiong / vim-highlighter

Highlight words and expressions
MIT License
226 stars 9 forks source link

[Question] Is it possible to toggle highlight? #30

Closed kagbodji closed 3 weeks ago

kagbodji commented 3 weeks ago

Hi there,

I am aware of Hi + (f). and Hi - (f) to add / remove highlight. I am wondering if there exists the functionality to highlight a word/selection if no current highlight exists, else remove the highlight, i.e., toggle the highlight. The idea to use a single keymap to quickly toggle highlight, similar to how quickhl does it. If not, I'd like to request this feature. Happy to implement it as well if you can point me in the right direction, I'm a novice in vimscript.

Thanks!

azabiong commented 3 weeks ago

Hi Kwami, It looks interesting and I think it's a good idea! I added the following options to make it work as you described:

:h HiSetToggle

Would you like to try it? Thank you.

kagbodji commented 3 weeks ago

wow, that was fast!! Works like a charm, thanks!!

kagbodji commented 3 weeks ago

the new HiSetToggle setting implements this. Thanks!