With the vim editor open
:set number or
:set nu
The line numbers will be displayed while the file is open.
With the vim editor open
:set nonumber or
:set nonu
The line number that was displayed is hidden.
When it is troublesome to type : set number
one by one,
Edit the configuration file in the vim editor.
$ vi ~/.vimrc
After opening the configuration file with the vim editor, add the following line Save the file.
set number
This completes the settings. The next time you open the vim editor, the line numbers will be displayed automatically. If the ~ / .vimrc file does not exist, you can create a new one and make the above settings.
[Supplement] I was able to set it not only on Linux but also on Mac.
Recommended Posts