echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.54k stars 175 forks source link

mini.cursorword: Ignore short word (single char or 2 chars) #850

Closed haunt98 closed 2 months ago

haunt98 commented 2 months ago

Contributing guidelines

Module(s)

mini.cursorword

Description

Is there a way to disable mini.cursorword when I click to short word (single char). For example: a-b-c, when I move to a I don't want to hightlight all word a.

echasnovski commented 2 months ago

Unfortunately, no.

The whole idea of 'mini.cursorword' is to highlight whole word under cursor. In the same way as would built-in *, #, etc. work.

So although I do understand the appeal of not highlighting short words, this is both not easy to do with current implementation (which uses built-in matches and Vim patterns) and not aligned with built-in behavior.

For example: a-b-c, when I move to a I don't want to hightlight all word a.

For this particular example I can suggest to add "-" character to a list of characters that are recognized as a part of what Neovim considers to be a "keyword". This can be done by modifying 'iskeyword' option like so: vim.opt.iskeyword:append('-').


Closing as not planned.

haunt98 commented 2 months ago

Hi @echasnovski , thanks for fast reply. Your sugestion works!