Print
Written by Tech Notes
Category: Programming
Published: 23 April 2014
VIM   VI.   Line Numbers   set nu   set number  

How To Show Line Numbers In VIM (VI) Editor

 

To Turn On Line Numbers In VIM

To see line number when using VIM (VI), which have no impact on your file content and used for guidance, do the following:

  1. Open a file with VIM.

  2. Enter :set number or :set nu.

To Turn Off Line Numbers In VIM

To no longer see the line numbers show in VIM, then do the following while using the VIM (VI) editor:

  1. Enter :set nu! .

To Make Line Numbers Be On Every Time You Start VIM

To make the line numbers show automatically when you edit a file with VIM, then do the following:

  1. Edit your user's profile .vimrc file or make a new .vimrc file using VIM

    vi ~/.vimrc

  2. Scroll to bottom of file >> and Go into Insert Mode by pushing i on your keyboard >> and add this line:

    set number

  3. Save and Close the .vimrc file:

    Enter :wq .

 

Feel Free To Leave A Good Comment. :)

Look around, and you may find other useful articles.