How To Show Line Numbers In vi / vim Text Editor

vi / vim show line number command

To display line numbers along the left side of a window, type any one of the following:
:set number
or
:set nu


(Fig.01: Vi / Vim line numbers in action – click to enlarge image)
To turn off line number again enter the same command:
:set nu!
If you need number every time you start vi/vim, append following line to your ~/.vimrc file:
set number
Save and close the file.
Jump to particular line number from a shell prompt, enter:
$ vi +linenumber file.c
$ vi +300 initlib.c

From : nixcraft

Leave a Reply

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