更新时间:2023-12-03 17:10:40
假设您有一个宏q
,该宏在一行上运行(并保持运行).然后,您可以使用以下命令在选择的每一行上运行它:
Suppose you had a macro q
that ran (and remained) on a single line. Then you could run it on every line in your selection with:
:'<,'>normal @q
(如果您已经选择了一组行,则在命令行上按:
会产生:'<,'>
)
(if you already have a group of lines selected, hitting :
produces :'<,'>
on the command line)
例如,以下宏将一行中除第一个单词外的所有单词大写:
For example, the following macro capitalizes every word but the first on a line:
:let @q="^dwgU$P"
因此,请在以下(选择+
行的地方)上运行它
So running it on the following (where the +
lines are selected)
0000: a long long time ago
0001: in a galaxy far away
+0002: naboo was under an attack
+0003: and i thought me and qui-gon jinn
+0004: could talk the federation in
0005: to maybe cutting them a little slack.
使用上面的normal @q
命令,生成:
With the above normal @q
command, produces:
0000: a long long time ago
0001: in a galaxy far away
0002: naboo WAS UNDER AN ATTACK
0003: and I THOUGHT ME AND QUI-GON JINN
0004: could TALK THE FEDERATION IN
0005: to maybe cutting them a little slack.