I've made this commitment to vim recently and I'm still a novice.
But I just had what may be my first true zen moment with the editor!
The problem:
* I needed to fix a single spacing annoyance in a set of over 40 php files.
The solution:
* Open all php files rooted in foo, luckily 90% were all at the same leaf level
vim /foo/*/*/*\.php
* Start recording a macro in register a
qa
* Make edits
[a fair bit of jj and dd and i etc.]
* Write changes
:w
* Open next file
:bn
* Stop recording
q
After pressing
@a
a few times to execute the macro, or :bn
if the file could be left alone, I was done.I've always wanted to be able to do this sort of thing so easily, but it's elusive or cumbersome with most GUI editors. Many UNIX text munging tools exist too, but it's often easier to take direct route of
So, I'm liking the taste of vim kool-aid thus far.
No comments:
Post a Comment