我想在选择中的每一行上运行一个宏,而不是总计我的头中的行数。例如,我可能写一个宏来转换:
Last,First
进入
First Last
我想让它运行在所有这些行:
Stewart,John Pumpkin,Freddy Mai,Stefan ...
任何想法Vim大师?
编辑:这只是一个例子,显然这是trivialy regexable,但有其他的实例,不是那么容易,我喜欢使用宏。
假设你有一个宏q在一行上运行(并保持)。然后你可以在你选择的每一行上运行它:
原文链接:https://www.f2er.com/bash/391819.html:'<,'>normal @q
(如果您已经选择了一组行,则在命令行中执行:hs:produce:’<,'>)
例如,以下宏大写每个单词,但第一行在一行上:
:let @q="^dwgU$P"
所以运行它在以下(在哪里选择线)
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.
使用上述正常的@q命令,产生:
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.