Vi is a popular text editor for Linux and BSD environments. It gives a lot of features to the user. But its learning curve is a bit complex. Actually learning vim is complex but after learning, it is very comfortable to work with text files. Vi is used by the system administrators, users, developers. Developers use vim too. Because vim has very good syntax highlighting and wide programming language, configuration file support. Vi has the ability to auto-complete too. But today we will look at how to show line numbers and make this configuration persistent.
Show Line Numbers
Now we can set line number options. We will write the following command in the normal mode. To switch normal mode press ESC. We will use set number
configuration command. This command will add a column that will contain the line numbers starting from 1.
:set number

Hide Line Numbers
We can hide existing line numbers with the following command. We will use set nonumber
configuration command. Existing line numbers can be hidden with the following command and the left column will be removed as the line numbers will not show.
:set nonumber

Make Line Number Display Configuration Persistent
Changing all time the line number settings is a tedious task. It can be made persistent in the line number setting by changing the user or global vim configuration.
$ echo "set number" >> .vimrc
Make No Line Number Display Configuration Persistent
Changing all time the line number settings is a tedious task. It can be made persistent in the line number setting by changing the user or global vim configuration.
$ echo "set nonumber" >> .vimrc