09-22-2011
2,977,
644
Join Date: Oct 2010
Last Activity: 14 September 2019, 1:15 PM EDT
Location: France
Posts: 2,977
Thanks Given: 88
Thanked 644 Times in 613 Posts
@Phamnu :
What you have to understand is :
when in vi or vim you have 2 main mode :
- insertion mode (when you type your code)
- command mode (when you want to tell vi/vim to do some specific actions, line jump, cursor move ...)
With normal bindings, to switch to command mode, press <ESC>
To switch to insert mode, you can use different command (i : insert where your cursor is, I insert at beginning of the line you are on, o, open a line under which you are, O open line above which you are.
a) <ESC> go to command mode
b) 1G go to first line
c) 19yy yank 19 lines including the line your cursor is on
d) nG go on the nth line under which you want to insert the lines
e) p paste the lines previously yanked.