Vi is popular text editor for Linux and BSD environment. It gives a lot of feature 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 system administrator, users, developers. Developers uses vim too. Because vim have very good syntax highlighting and wide programming language, configuration file support. Vi has the ability to auto complete too. But today we will look how to show line numbers and make this configuration persistent.
Show Line Numbers
We open our test file named my.c like below
$ vim my.c
Now we can set line number options. We will write following command in the normal mode. To switch normal mode press ESC
Hide Line Numbers
We can hide existing line numbers with the following command.
Make Line Number Configuration Persistent
Changing all time the line number settings is tedious task. It can be made persistent the line number setting by changing user or global vim configuration.
$ echo "set number" >> .vimrc