我正在尝试找到一个模式并删除该块。
要删除阻止我手动执行V$%x
。
V - 行选择,$ - 移动到行尾(有一行{end of line),% - 移动到匹配},x - 删除块
我想知道有没有办法实现自动化。有全局命令:g
但我不知道如何在命令模式下选择文本。
答案 0 :(得分:6)
仅供记录,找到解决方案
编辑:
:g/pattern/norm! V$%x
答案 1 :(得分:0)
按v
激活视觉模式后,您可以选择:
aw a word (with white space)
iw inner word
aW a WORD (with white space)
iW inner WORD
as a sentence (with white space)
is inner sentence
ap a paragraph (with white space)
ip inner paragraph
ab a () block (with parenthesis)
ib inner () block
aB a {} block (with braces)
iB inner {} block
a< a <> block (with <>)
i< inner <> block
a[ a [] block (with [])
i[ inner [] block
希望有所帮助