无法计算Vim中的匹配数
如何计算Vim中的匹配数 例如,对于文本无法计算Vim中的匹配数,vim,count,match,Vim,Count,Match,如何计算Vim中的匹配数 例如,对于文本 <? :%s/描述了您的目标 :%s/<?/whatever/ng :%s/ 在VIM 6.3中,您可以这样做: :set report=0 :%s/<?/&/g # returns the count without substitution :%s/<?/&/gn # returns the count without substitution :设置报告=0 :%s/I收到错误消息“尾部字符”
<?
:%s/描述了您的目标
:%s/<?/whatever/ng
:%s/
在VIM 6.3中,您可以这样做:
:set report=0
:%s/<?/&/g # returns the count without substitution
:%s/<?/&/gn # returns the count without substitution
:设置报告=0
:%s/I收到错误消息“尾部字符”。我也尝试了使用“:set report=0”的代码。我会再试一次,尾随字符的帮助描述了“一个参数已添加到一个不允许的Ex命令中。”Hrmm。。对不起,玛西,我不知道你怎么了。我只是在我的机器上的vim缓冲区中再次检查了这一点,它工作正常。如果你从web浏览器复制/粘贴代码,你可能会得到一个尾随的换行符(^M)。试着手动输入。@Brian:我找到了问题的根源。我的服务器上的Vim版本是6.3。当我在Vim 7.2上运行它时,代码工作得非常好。谢谢你的帮助!
:set report=0
:%s/<?/&/g # returns the count without substitution
:%s/<?/&/gn # returns the count without substitution