【发布时间】:2016-12-07 13:17:24
【问题描述】:
在以下文本行中,我想将全局命令搜索中的匹配文本添加到全局命令之后指定的范围
所以要从中得到
Number 1
indentA
indentB
Number 2
indentC
indentD
到这里
Number 1
1 indentA
1 indentB
Number 2
2 indentC
2 indentD
不久前我看到了一个类似的问题和答案,但我一生都找不到它。以下是我失败的尝试之一。我理解它为什么不起作用,但不知道如何更改它以使其起作用。
:g/\d$/+1,+2s/indent/\=submatch(0).'indent'
【问题讨论】:
标签: regex vim replace range match