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.
- 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"
- Either log-out and log back in or "source" your shell start-up file.