VIM +n filename: Cursor positioned to nth row of filename
Shortcut keys:
J Move Down, K move up, H shift, L move right, ctrl+f or pageup up one screen, ctrl+b or pagedown down one screen.
GG moves to the first line, and G moves to the last row.
NG, move to Nth row.
X, delete one character backwards, X, delete one character forward
NX, removing n characters backwards
DD, delete/cut the row
NDD, delete/cut rows up to a total of n rows
DW, deleting the string after the cursor
YY, the copy cursor is in the row
p, paste down, p, paste up
Nyy, where rows are copied down n rows
U, restore previous action (up to 50 times)
V, moving the cursor after pressing V will select the specified character
Ctrl+r, undo the operation of U
I, inserted in the current word match either, I, at the beginning of the line where the cursor is inserted
A, inserted at the current word specifier, a, at the end of the current line
O, insert in next line, O, insert on previous line
/, followed by the string to find, press N to search backwards
? , followed by the string you need to find, press N to search forward
: n1,n2s/word1/word2/g, find word1 between n1,n2 rows and replace with Word2, and no G replaces only the first word1 of each row
: 1. $s/word1/word2/g, replace all word1 in the document with Word2, and no G replaces only the first word1 of each row
: Set NU Displays line number
: Set Nonu does not display line numbers
Vim's frequently used shortcut keys