rhysd / clever-f.vim

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

Reset repeat on Escape #11

Closed pirj closed 10 years ago

pirj commented 10 years ago

Is there a quick option to make clever-f forget about the character to search not only on movement, but also on Esc. After all, 'f' is not so consistent when:

input    fa      x fa
move   ---->_----->_
text   1    abc   da

This is as expected (cursor stays still), but:

input    fa    d0 fa
move   ---->_
move   _<
text   1    abc   da

In this case cursor moves and clever-f won't find next match anymore.

Would be nice if there were an option not to rely on previous_pos, and just reset clever-f on Esc (or C-f?).

I have tried, but my VimL skills are poor.

rhysd commented 10 years ago

Hi, @pirj. Sorry for the delay to catch this issue.

You can use <Plug>(clever-f-reset).
Please write below setting in your vimrc to reset the state on <Esc>.

nmap <Esc> <Plug>(clever-f-reset)
pirj commented 10 years ago

Works like a charm, thanks. "d0" action issue is still the case though.

pirj commented 10 years ago

nmap <Esc> <Plug>(clever-f-reset) is adding an odd side effect: when you open a file from CL like vim .xinitrc and then jump somewhere, it removes until that point. So G removes to the end of file. No other side effects spotted.

rhysd commented 10 years ago

"d0" action is not a bug. clever-f checks if should repeats previous search or not by the character under the cursor and the place of cursor. The check by only the character of under the cursor would make more mistakes; If the character is the same previous place you used clever-f accidentally, fmoves cursor unexpectedly.

rhysd commented 10 years ago

nmap <Esc> <Plug>(clever-f-reset) is adding an odd side effect: when you open a file from CL like > vim .xinitrc and then jump somewhere, it removes until that point. So G removes to the end of file.

I can't reproduce the issue. Could you please tell me the precondition ( e.g. .vimrc )?

pirj commented 10 years ago

All here. I've narrowed it down to just Vundle, set nocompatible and clever-f (with that nmap), and now when I start up vim, it's in REPLACE mode. If I comment nmap out, it's starting in NORMAL.

rhysd commented 10 years ago

Sorry for massive delay to respond.

I tried for reproduction but I couldn't. I want to investigate more but you no longer seem to use clever-f.vim. So I will close this issue. Sorry again.

If anyone can reproduce the above issue, please reopen this issue and report it.

rhysd commented 10 years ago

I've found Vim's bug which makes Vim start in replace mode.
https://groups.google.com/forum/#!topic/vim_dev/06REeb0ev2I/discussion

If your Vim doesn't have patch-389, please try to update Vim. You can check if your Vim has patch-389.

:echo v:version == 704 && has('patch389')