This article is a summary notes when learning Vim, so easy to find related commands in the forgotten, the original learning video link: https: //www.imooc.com/learn/1129
1.1 Vim four modes
1.normal mode: i / a / o and I / A / O insert mode, the meaning of various shortcuts is as follows:
i -- insert
a -- append
o -- open a line below
A -- append after line
I -- insert before line
O -- append a line above
2. Insert mode: Use Esc to exit the insert mode back to normal mode
3. Command Mode:
: Vs (vertical split) about split screen
: Sp (split) upper and lower split-screen
% S / XXX / YYY / g global replacement (replacement XXX with YYY)
4.visual mode:
v From the beginning of the current character
V Select current row
rectangular block selected ctrl + v
1.2 Vim insert mode tips
- ctrl + h to delete a character, ctrl + w to delete a word, ctrl + u delete the current row
- gi quickly back to where you just edited
1.3 Vim fast-moving
h 1.normal the left mode, j, a k, l and right
2. jump between words:
w / W move up a word / beginning WORD. The e / E a word / WORD tail
The b / B back to the beginning of a word / WORD
Description: word in a non-blank delimited word, WORD blank delimited word
3. interline mobile search:
f {char} char character to move, t is moved to the previous character char
If the first time is not found to be a semicolon / comma continue this search a row / a
Uppercase F indicates a reverse search
4. The horizontal movement:
0 move to the beginning of the line
$ Move to end of line
5. Page Mobile:
The beginning of the file gg
G end of file
Ctrl + o back to the previous position
------------------------------------
H beginning screen
M center of the screen
The end of the L screen
------------------------------------
Ctrl + u / f flip up and down
set the current line zz intermediate screen