我想在
vim中搜索一个模式,并在它出现的每一行上,将文本添加到行的末尾.例如,如果搜索模式是print(并且要添加的文本是):
from __future__ import print_function print('Pausing 30 seconds...' print("That's not a valid year!"
应该成为
from __future import print_function print('Pausing 30 seconds...') print("That's not a valid year!")
这个命令应该为你做:
:g/print(/norm! A)
它能做什么:
:g/print(/ "find all lines matching the regex norm! A) "do norm command,append a ")" at the end of the matched line.
你可能想检查一下
:h :g
详情.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。