Vim’s search and replace feature can count of how many times a word appears in a body of text. Take this file:
Thing Thing Thing
This command will count instances of
:%s/Thing//n 3 matches on 3 lines
n flag means:
Report the number of matches, do not actually substitute.
h/t Josh BranchaudTweet