[英]Unable to count the number of matches in Vim
How can you count the number of matches in Vim? 你如何计算Vim中的比赛数量?
For instance, for the text 例如,对于文本
<?
:%s/<?//ng
请参阅:h count-items
。
Count-items describes what you are after. 计数项目描述了您的目标。
:%s/<?/whatever/ng
This is the substitution command, but the n flag avoids the actual substitution. 这是替换命令,但是n标志避免了实际的替换。
:help count-items
In VIM 6.3, here's how you'd do it: 在VIM 6.3中,您可以这样做:
:set report=0
:%s/<?/&/g # returns the count without substitution
In VIM 7.2, here's how you'd do it: 在VIM 7.2中,您可以这样做:
:%s/<?/&/gn # returns the count without substitution
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.