News for hackers. Stuff that matters.
Re:Intermediate Vim by weavie on Wednesday May 01, 2019 @05:11AM (#19795579)
I was going to say that one annoying thing about these macros is you can't press . to repeat the last macro. It is annoying having to count out 143 lines and then do 143@x or what I tend to do is do it in batches of say 20 until I get to the end..

But this has prompted me to look this up and it turns out that you can use @@ to do this. This will make my life a lot easier, I can just smash <Shift 2> until all my lines are updated.

Re:Intermediate Vim by mbudde on Wednesday May 01, 2019 @06:56AM (#19795981)
You can also visual select all the lines and then do

  :'<,'>norm @x
Re:Intermediate Vim by tomsmeding on Wednesday May 01, 2019 @07:32AM (#19796145)
Another notable trick is that vim registers are case-insensitive -- and since macro's are just stored in registers, macro's are case-insenstitive as well. so @q == @Q, which alleviates some of the RSI problems with spamming @q.
Re:Intermediate Vim by n8henrie on Wednesday May 01, 2019 @09:39AM (#19796867)
I remember something about a capital register appending instead of overwriting -- is that only for saving (with no influence in execution)?
Re:Intermediate Vim by majewsky on Wednesday May 01, 2019 @12:19PM (#19798606)
Yes, that's only for writing. For example, to collect all lines matching a pattern into a register with

  :g/pattern/y A
you need to use an uppercase register ("A" in this case) because it executes `y` once per match. With `y a` instead of `y A`, you would end up having only the last match in the register.