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

Breaks macros #59

Closed aldevv closed 3 years ago

aldevv commented 3 years ago

Say you have the following line 1a 2a 3a 4a 5a, and you wish to delete all of the a in this line, to do this you record the following macro: qqfax which leaves you with the following line after recording: 1 2a 3a 4a 5a. from there, to delete the rest of the a you would simply call the macro by doing 4@q.

Expected Behaviour

to get a line like this: 1 2 3 4 5

Actual Behaviour

1 2axfaxfaxfax 3a 4a 5a

steps to reproduce

  1. qq start macro
  2. fax (find next a and delete it with the x key)
  3. q
  4. 4@q

vim

neovim 0.5.0 nightly (bare config)

rhysd commented 3 years ago

I apologize that this issue is missed. I could reproduce this with your reproduction. I'll take a look

rhysd commented 3 years ago

I created a script for this:

call setreg('q', 'fax')
normal! 4@q
rhysd commented 3 years ago

I understood what happened.

1a 2a

Having this text and cursor is on 1 and q register has fax. When running 2@q, it simply enters input faxfax.

The first fax runs as expected. It removes first a after 1. Now text is 1 2a and cursor is on the whitespace.

Remaining input is fax. Since the cursor does not move after first fa, clever-f.vim repeats searching a character without waiting for user input on the second f. It means that the second a input is consumed as starting insert mode after the cursor and the second x input is simply put in buffer. So the final text is 1 2ax.

rhysd commented 3 years ago

038b09c addressed this issue. Thanks for reporting this issue.