Show Line Numbers in Vi or Vim
Displaying line numbers while editing a file can be useful. This recipe describes how to turn on and off the display of line numbers in the vi and vim editors.
Obviously, displaying line numbers is essential when debugging code and scripts. While editing a document (and not inserting text), type the following to turn on line numbers:
If you are in insert or append mode in vi / vim editor, this will not work correctly. Just strike the Esc key to exit this mode and try again.
If you tire of the line numbers, enter the following command to turn them off:
Follow the reactions below and share your own thoughts.