How to display line number in vim

To display line numbers in Vim, you can use the following command in command mode:

:set number

This will display line numbers on the left-hand side of the screen. To turn off line numbering, use the following command:

:set nonumber

You can also use the short version of the above commands by replacing set with se:

:se number
:se nonumber

Once you have set the line numbers, you can use them to navigate to specific lines by entering the line number in command mode and pressing Enter. For example, to go to line 42, you can type :42<Enter>.

Leave a Comment