i = Insert mode
o = instert new line
h = left
j = Move down
k = Move up
l =right
r = replace current character
x = remove a current character
dd = delete line
dw = delete Word
wq = Write and Quit Vim
q! = Quit with out saving
To search
/searchterm and press enter and then press N to next occurrence,
Copy and Pasting lines in VIM
- Make sure you’re in the normal mode. Press
Esc
to be sure. Then copy the entire line by pressing yy
(more info :help yy
). Y stands for “yank
“. Instead, you can also press Y
(shift + y) but I find the former a bit more convenient.
- Paste the line by pressing
p
. That will put the yanked line right under your cursor (on the next line). You can also paste before your current line by pressing the capital letter P
. Again, to get some help you can use :help p
.
Copy and Pasting in VIM
- Position the cursor where you want to begin cutting.
- Press
v
to select characters (or uppercase V
to select whole lines, or Ctrl-v
to select rectangular blocks).
- Move the cursor to the end of what you want to cut.
- Press
d
to cut (or y
to copy).
- Move to where you would like to paste.
- Press
P
to paste before the cursor, or p
to paste after.