Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f and t in macros #22

Open
nathanbraun opened this issue Feb 24, 2015 · 7 comments
Open

f and t in macros #22

nathanbraun opened this issue Feb 24, 2015 · 7 comments

Comments

@nathanbraun
Copy link

It doesn't look like f and t work in user recorded macros, example:

qqfaq

would record a macro that moves to the next 'a' in a line. If I do that, then move to another line and call it via:

@q

nothing happens. Is this something that could be added? Great plugin, thanks!

@rhysd
Copy link
Owner

rhysd commented Mar 1, 2015

Hi, @nathanbraun

Sorry for the delay 💦

I tried qqfaq -> @q and it seemed to work well in my environment (OS X 10.10 and Vim 7.4p383).
Could you please tell me your environment to reproduce this issue?

@JoseConseco
Copy link

JoseConseco commented Apr 18, 2021

6 years later I can confirm it does not work well with macros - if you use f 2x in row. eg:

use 'macro_wont/work'

We have cursor on beginning of line and macro is: go forward to second quote, and then paste text in there.
On replaying macro we should get:
use 'macro_wont/work'PASTE

But we get no result at all. Macro is: f'fp
@rhysd hope u can make it work since plugin is great

@rhysd
Copy link
Owner

rhysd commented May 4, 2021

@JoseConseco Would you explain your sequence with what you typed? I want to reproduce exactly the same issue.

My understanding is:

  1. Save the following contents as foo.txt
  2. Open Vim
  3. qq
  4. f'f (move to the second quote)
  5. p (paste something)
  6. q (stop recording macro)
  7. Go to next line
  8. @q
use 'foo/bar'
use 'foo/bar'

Is this correct?

@JoseConseco
Copy link

JoseConseco commented May 4, 2021

Yes see below - first I record qq macro with - f'f action. Then I try to re-run it with @q

PasteF.mp4

Cursor goes to completely wrong place - it goes bottom line at the end of video - after running the macro. In any case I switched to vim-sneak so if you are not longer working on developing this plugin then that is ok.
Also I'm not sure if that changes anything but I used P for pasting.

@W4RH4WK
Copy link

W4RH4WK commented May 27, 2021

I can also confirm that there are instances where clever-f does not work with macros correctly.

It'd be fine for me if clever-f is disabled during macro recording / replay.

@jam1015
Copy link

jam1015 commented Sep 10, 2021

There might be a solution in this comment thread: ggandor/lightspeed.nvim#7

@cd-a
Copy link

cd-a commented Feb 17, 2022

For reference to whoever has the same issue, this is what I use which works just fine. (Analog to the issue of lightspeed.)
It disables the plugin during both running and the execution of plugins.

" make sure to set this, otherwise it won't work
let g:clever_f_not_overwrites_standard_mappings = 1

nmap <expr> f reg_recording() .. reg_executing() == "" ? "<Plug>(clever-f-f)" : "f"
nmap <expr> F reg_recording() .. reg_executing() == "" ? "<Plug>(clever-f-F)" : "F"
nmap <expr> t reg_recording() .. reg_executing() == "" ? "<Plug>(clever-f-t)" : "t"
nmap <expr> T reg_recording() .. reg_executing() == "" ? "<Plug>(clever-f-T)" : "T"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants