rhysd / clever-f.vim

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

Enhancment: prevent clever-f from jumping outside of current line (typo ...) #79

Open jidhub opened 8 months ago

jidhub commented 8 months ago

I often use clever-f.vim, this is very useful to my day to day usage, thank you. I have already contributed, by enabling non-ASCII chars.

clever-f speeds up a lot editing my files.

But clever-f combined with typing error just after "f" makes my vim cursor jump to a line I did not want, sometimes pages away. It would be nice to add a setting that prevent clever-f from jumping outside of current line.

Another advantage would be that this setting, combined with the following settings, would finally enable clever-f to have no effect besides visual effects:

let g:clever_f_mark_direct=1 " highlight f destinations let g:clever_f_timeout_ms=1 " subsequent f work normally after 1 milisecond let g:clever_f_mark_char=0 " don't spray display for what is possible in that 1 ms let g:clever_f_highlight_timeout_ms=1000 " for ; and ,

jidhub commented 8 months ago

If clever-f knows about the keymap of the keyboard, f followed by a char not on the line could jump to the keyboard key on left or on right of typed key, depending on which is closer to the current cursor. I may someday submit a pull-request about that.