vim count occurrences of a word


To count occurrences of a word in vim run following expression:


Here I am opening a file with vim editor and calculating number occurrences of a word “done”.

It will display count in status line without changing buffer. This expression is supported by recent versions of vim only.

In older versions of vim use following expression:


This expression will edit file and shows us count. After viewing count in status line press u to undo changes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s