Vim: Counting the number of matches…

A useful trick in Vim to return the number of matched expressions in a file;

let x=0 | g/regexp/let x=x+1
echo x

where regexp obviously is the regular expression (pattern) you wish to count.

Explore posts in the same categories: Technical

Comments are closed.