replay a vim macro until end of buffer

后端 未结 5 562
悲&欢浪女
悲&欢浪女 2021-01-29 21:43

I want to run a macro I just recorded in register \"x\" on every single line of an open buffer, from my cursor to end of the buffer, in vim. How do I do that?

相关标签:
5条回答
  • 2021-01-29 22:02

    make recursive macro:

    qa@aq
    

    ex:

    qa0gUwj@aq
    

    It'll UPCASE first word from current line to the end of file with single @a. But make sure "a register is empty:

    let @a=""
    
    0 讨论(0)
  • 2021-01-29 22:05

    999999@x, unless you have a very large buffer...

    0 讨论(0)
  • 2021-01-29 22:06

    From vim wiki, shortened version: qqqqq to record the macro @qq to finish recording @q to execute it (and will run till end of the file)

    0 讨论(0)
  • 2021-01-29 22:07

    Personally I would do

    VG:normal @x
    

    Edit: changed register to the one you specified.

    0 讨论(0)
  • 2021-01-29 22:14

    You can do (in command mode)

    :%normal @x
    
    0 讨论(0)
提交回复
热议问题