Posts Tagged ‘vi’

How to show line number in vi or vim

March 4, 2011 2 comments

Line number in editing text using vi or vim is very useful. It is not shown by default, we can make it visible??. There are two ways that we can do

First, while editing mode (not in inserting text mode), type the following

:set number

to hide it, just type the following

:set nonumber

Second, we can make vi or vim show line number by default. To do it, just write .vimrc in your home directory and add set number (without colon)

If we want to associate with keys (for example f6), we need to type the following in .vmrc

nnoremap <silent> <f6> :set number!<cr></cr></f6></silent>
Tags: , , ,
%d bloggers like this: