How do I show lines in vi or vim text editor?

How do I show lines in vi or vim text editor?

In the vi or vim text editor, you can show line numbers by using the "set number" command. This will display the line numbers on the left side of the editor window, which can be helpful for navigation and reference.

To show line numbers in vi or vim, follow these steps:

  1. Open the vi or vim text editor and the file you want to edit. For example:
ref‮‬er to:lautturi.com
vi myfile.txt
  1. Press the "Esc" key to enter command mode.

  2. Type the following command and press "Enter":

:set number

This will show line numbers in the editor window.

  1. To hide the line numbers again, use the "set nonumber" command:
:set nonumber

With these steps, you should be able to show or hide line numbers in vi or vim. The "set number" and "set nonumber" commands can also be added to the vimrc configuration file to enable or disable line numbers by default. Consult the documentation of vi or vim for more information on these commands and other options for displaying line numbers.

Created Time:2017-10-28 21:38:56  Author:lautturi