说有两行像
1:Could be anything
2:FOO is a word
现在我想通过使用/FOO
搜索:%s
来编辑#1行,或者我想在其中包含FOO的行上方添加一个新行。
答案 0 :(得分:3)
:help :global
是你的朋友。
此命令:
:g/FOO/-2s/any/some
会转:
1:Could be anything
2:FOO is a word
成:
1:Could be something
2:FOO is a word
这个命令:
:g/FOO/normal! O
会转:
1:Could be something
2:FOO is a word
成:
1:Could be something
2:FOO is a word