rhysd / clever-f.vim

Extended f, F, t and T key mappings for Vim.
https://rhysd.github.io/clever-f.vim
1k stars 44 forks source link

`<Plug>(clever-f-reset)` doesn't reset highlight #61

Open ram02z opened 3 years ago

ram02z commented 3 years ago

I have the following map in my config: nmap <Esc> <Plug>(clever-f-reset)

Moving the cursor resets the highlights, but pressing <Esc> doesn't. However, it does reset the searching character.

macintacos commented 3 years ago

Hack I did was just add :noh<CR> at the end of it. Would be nice to not have to do that though.

dragon-architect commented 2 years ago

That hack was the exact configuration that I attempted in my own vimrc, before I even saw this open issue, and it didn't work for me. I tried both :noh<CR><Plug>(clever-f-reset) and <Plug>(clever-f-reset):noh<CR>.

BertrandSim commented 2 years ago

I did a little bit of debugging. In my case, I noticed that the function clever_f#reset() in "autoload/clever_f.vim" returns an empty string (''). Changing its return value to a non-empty string that does a no-op, such as return "\<Esc>", works for me.

BertrandSim commented 2 years ago

Alternatively, bypass the <Plug> mapping, and call the reset function directly, that is

nnoremap <Esc> :<C-u>call clever_f#reset()<CR>