繁体   English   中英

无法计算Vim中的匹配数

[英]Unable to count the number of matches in Vim

你如何计算Vim中的比赛数量?

例如,对于文本

<?
:%s/<?//ng

请参阅:h count-items

计数项目描述了您的目标。

:%s/<?/whatever/ng

这是替换命令,但是n标志避免了实际的替换。

:help count-items

在VIM 6.3中,您可以这样做:

:set report=0
:%s/<?/&/g   # returns the count without substitution

在VIM 7.2中,您可以这样做:

:%s/<?/&/gn   # returns the count without substitution

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM