Vi: Displaying Line Numbers

Purdue Engineering Computer Network
To display the line numbers in the left margin of a vi document, type :set nu. To turn them off again, type :set nonu.

If you want vi to display line numbers by default, you need to set the EXINIT to set nu.

You can set this in your .login or your shell start-up files.

  1. Open your editor to edit your .login or your shell start-up file. Add the following lines:

    For C-Shell:

    	setenv EXINIT "set nu"
    
    For Bourne or Korn Shell:
    	EXINIT="set nu"; export EXINIT     
    
    For Korn Shell Only (alternate method):
    	typeset -x EXINIT="set nu"
    
  2. Either log-out and log back in or "source" your shell start-up file.

-- Alternatively, you can put set nu in your .exrc file in your home directory -Suggested by Ian Donaldson--

Last modified: 2007/11/06 14:25:0.295000 US/Eastern by
Created: 2007/11/06 14:25:0.295000 US/Eastern by brian.r.brinegar.1.

Categories

Search

Type in a few keywords describing what information you are looking for in the text box below.

Admin Options: Edit this Document