Show line numbers:
:set nu
“Unshow” line numbers:
:set nonu
Add show/unshow line numbering in vim (F12 key) Add following to /etc/vimrc
nmap <F12> :set number!<CR>
Current line = .
Insert comment character on current and next 5 lines:
:.,+5s/^/#/g
Change all appearances of from to morf from line 1 to current line:
:1,.s/from/morf/g
Mark the area which is to be commented using the *blockwise* visual mode (CTRL-V)
Press I (capital i) and write the text you want to prepend to each line of the selected block, e.g. %.
Then press ESC and the text will be inserted to the left of each line of the selected block.
Shift + v