“全局”选项不能按预期工作(这似乎最近才改变,但我无法找到差异的原因).
鉴于这条线:
ABA
我发出命令:
:S / A //克
我希望结果如下:
b
但是,生成的行是:
BA
我错过了什么?
@H_301_19@@H_301_19@
您很可能在.vimrc中设置了gdefault.
来自:help gdefault:
When on,the ":substitute" flag 'g' is default on. This means that all matches in a line are substituted instead of one. When a 'g' flag is given to a ":substitute" command,this will toggle the substitution of all or one match.
如果你没有在配置中设置它,你可以通过发出:verbose set gdefault?来查看它的设置位置.
@H_301_19@