Vim tip: counting lines in a selection

This is one of those posts that are here so I have something to go back to.

To count the number of lines in a selection in Vim, do :'<,'>s.
The way to do it without losing the selection is g CTRL-G.
It’s even easier with showcmd enabled (:set showcmd) since it shows the number of lines in the command area.

See :help count-items.

Advertisements

`$name' says...

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: