Closed JoseConseco closed 2 years ago
Hi, Thanks for your opinion!
So, currently the HiErase
key is being used for One Time Highlight function when the cursor is over an unhighlighted word. Are you referring to when a key is pressed in an empty space?
Ah ok, I can see HiErase is doing One Time Hl - it was just hard to spot since I have lsp hover highlight, which is put on top. For users like me, it would be more helpfull for HiErase to remove all highlights, if cursor is not over highlighted word (and it seems more logical than using HiErase to add OneTimeHl) . Maybe thing like this could be done with adding callback? Something like:
fun after_hi_erase(cword_hl)
-- user defined behavior e. g.
if no cword_hl then
ClearAll() -- or SetOne TimeHL()
Oh, I see. And then, you want to use HiClear
function using One Time Highlight
key, correct?
To do that, I think we can add an option something like this.
let HiClearUsingOneTime = 1
When this option is set, HiClear
function will be called when the HiErase
key is pressed over an unhighlighted word, instead of One Time Highlight
. What do you think?
Sounds good to me.
Okay, I will proceed, and test, update and let you know when it's done!
It's ready! Please see :h HiClearUsingOneTime
. I hope you like it 😄
Thanks. It works great!
let HiErase = 'f<BS>'
Deletes highlight from word under cursor. IMO It would be cool if cursor is not on any highlighted word, then it would remove all highlights (HiClear). Not big deal, but It would save me having to map extra mapping for HiClear (all)