News for hackers. Stuff that matters.
Re:Programs that have saved me 100+ hours by dasil003 on Thursday March 16, 2017 @03:37PM (#13888408)
My favorite use of macros is as a sort of progressive global search and replace on steroids. I have @q bound to Space, so I can record a macro with qq, then hit space to repeat. Since the macro is just a list of commands in a register I can copy it out and edit it to tweak it, once I'm happy with it over a few lines I can make it recursive by adding @q to the end of it.

Compared to regex search and replace this is much more malleable, interactive, and ultimately powerful.

Re:Programs that have saved me 100+ hours by fiddlerwoaroof on Thursday March 16, 2017 @05:39PM (#13889445)
It's worth remembering that . (i.e. dot) repeats the last edit command. vim-repeat ( https://github.com/tpope/vim-repeat ) makes this even better.

Although, there are still several situations where macros are better, especially things that involve several motions and edits. (I tend to use qw because w is more convenient to hit after @).

Also, it's occasionally useful to remember that you can use the double quote character " to paste a macro, edit it and then update it. i.e. ( "ep .... edit ... ^"ed$ )

Re:Programs that have saved me 100+ hours by fiddlerwoaroof on Thursday March 16, 2017 @05:41PM (#13889459)
Also, vim-surround is one of those things that, once you've used it for a while, it's impossible to think of editing text without it: https://github.com/tpope/vim-surround
Re:Programs that have saved me 100+ hours by dasil003 on Thursday March 16, 2017 @06:47PM (#13889853)
Any vim user can profit from visiting https://github.com/tpope?q=vim&tab=repositories and trying any one that looks vaguely interesting.
Re:Programs that have saved me 100+ hours by mkingston on Thursday March 16, 2017 @08:48PM (#13890446)
Somewhere between the default and your binding: @@ repeats the last macro. So you can record your macro, go to your search text, @q, n, then for all subsequent matches @@.