Want to show line numbers in the vi/
vim editor in the linux system like ubuntu..? Ok I will explain you
how to show numbers in the editor of linux in two methods.
1. Temporary Method:
1. To display line numbers in the file,
open the file in vim/ vi editor through terminal
2. Press [ESC] button and : (colon)
and the type “set number” then press enter,
then you will get numbers in the
file...
Note: If you want to hide the numbers you can type the following command by preesing [ESC] and : in the vi/vim
editor
:set nonumber
2. Perminent Method:
To make vim/ vi editor to show numbers
defaulty follow the procedure below:
1. Open the file .vimrc in your home
directory (/home/username/.vimrc) by typing as following
$vim ~/.vimrc
(If the file already not exists, it
will be created with no text)
2. Then edit the file by typing the
text below,
set number
Then Press ESC button and Colon
button to go to command mode, then press wq (for saving and quit
the file)
:wq
3. Its done. All your files now defaulty will open with Line numbers
Note: If you don't want to defaulty
showing Line numbers, remove the line edited in .vimrc
No comments:
Post a Comment