本文共 708 字,大约阅读时间需要 2 分钟。
如何在vim中全部替换
Search and replace in the whole text in Vim can be done by :%s/from/to/gc
. But how to search and replace in visual selection only?
在Vim中搜索和替换全文可以通过:%s/from/to/gc
。 但是,如何仅在视觉选择中进行搜索和替换?
The %V
atom in Vim restricts a pattern so that it matches only inside the visual selection.
Vim中的%V
原子限制了模式,因此它仅在视觉选择内匹配。
So, your for searching and replacing only in the visual selection can be
因此,仅在视觉选择中用于搜索和替换的可以是
:%s/%Vfrom/to/gc
In addition, you can use marks for the beginning and end of the visual selection as the ,end
range for the :s
command:
另外,可以将标记用于视觉选择的开始和结束,作为:s
命令的 ,end
范围:
'< start line`< start character'> end line`> end character
翻译自:
如何在vim中全部替换
转载地址:http://bqlwd.baihongyu.com/