Vim Macro on Every Line of Visual Selection -
i'd run macro on every line in selection, rather totalling number of lines in head. instance, might write macro transform:
last, first into
first last and i'd run on these lines:
stewart, john pumpkin, freddy mai, stefan ... any ideas vim gurus?
edit: example, trivialy regexable, there other instances come aren't quite easy i'd prefer use macros.
suppose had macro q ran (and remained) on single line. run on every line in selection with:
:'<,'>normal @q (if have group of lines selected, hitting : produces :'<,'> on command line)
for example, following macro capitalizes every word first on line:
:let @q="^dwgu$p" so running on following (where + lines selected)
0000: long long time ago 0001: in galaxy far away +0002: naboo under attack +0003: , thought me , qui-gon jinn +0004: talk federation in 0005: maybe cutting them little slack. with above normal @q command, produces:
0000: long long time ago 0001: in galaxy far away 0002: naboo under attack 0003: , thought me , qui-gon jinn 0004: talk federation in 0005: maybe cutting them little slack.
Comments
Post a Comment