Tuesday, December 2, 2008

vim: how to count the number of matches of a pattern

Just enter this command:

:%s/pattern//gn

It will count how many times pattern is found and print the result on the status line.

No comments: