Vim Editor
1 vim Mode
Edit mode (command-line mode)
Last-line mode
Input mode
2 Mode Conversion
Command line------> input
I: Switch to input mode before the current cursor character
A: After the current cursor character, switch to input mode
O: Under the current cursor line, create a new row and switch to input mode
I: Switch to input mode at the beginning of the line where the cursor is currently located
A: At the end of the line where the current cursor is located, switch to input mode
O: At the top of the current cursor line, create a new row and switch to input mode
Enter------> Command line
ESC key
Command line------> last line (only editable mode enters last-line mode)
Use:
3 Closing files
3.1 Closing file in last-line mode
: Q exit
: Wq <==>:x Save and exit
: q! do not save and exit
: W Save
: W forcibly saved
4 moving the cursor in command line mode
4.1 Character-by-word movement
H: Left
K: Up
L: Right
J: Next
4.2 Move the cursor in the word unit
B: Jump to the beginning of the current or previous word
(If the cursor is positioned as a character, move to the beginning of the current word,
If a space is moved to the beginning of the previous word)
E: Jumps to the ending of the current or next word
#+b: Jump to the bottom # Word header
4.3 In-line jump
0: The absolute beginning
^: first non-whitespace character at the beginning of a line
$: absolute end of line
4.4 Inline Jump
#+g: Jump To Line #
G: Last line
The last line mode directly to the travel number can be
5 command-line mode Flip screen
CTRL+F: Flip one screen down
Ctrl+b: Turn up one screen
Ctrl+d: Flip Down half screen
Ctrl+u: Flip up half screen
6 editing text in command line mode
6.1 Deleting characters
X: Delete a single character at the cursor location
#+x: Remove the total # characters from the cursor and backwards
6.2 Delete Word command D
The D command is used in conjunction with the jump command
D+e: Delete the word or the next word where the current cursor is located
D+b: Delete the word or the last word where the current cursor is located
D+#+b: Delete the top # word on which the current cursor is located
6.3 Delete line command DD
DD: Deletes the current cursor in the row
#dd: Delete the # line in the row where the current cursor is located
6.4 Delete rows in the last row mode
#, #d start with # lines
.: When moving forward
$: Last 1 rows
$-3: Bottom 3rd Line
7 Paste command in command line mode
P: If the whole line is deleted or copied, paste it below the line where the cursor is located;
If you delete or copy a non-full line, paste it after the character that contains the cursor
P: If the whole line is deleted or copied, paste it above the line where the cursor is located;
If you delete or copy a non-full line, paste it in front of the character that contains the cursor
8 command line mode copy command y
Y: Usage with d command
YY: With DD
9 Modifying commands in the command line mode
Y: Usage with d command
YY: With DD
10 command-line mode replace command R
R: Replaces the character that the current cursor contains
R: Replace the character after the cursor by changing to replace mode
11 undo Edit operation in command line mode
U: Undo the previous edit operation
#+u: Undo Recent # This action
Ctrl+r: Undo the first 1 times
12 repeating the previous edit operation in command line mode
Use.
13 Visualization Mode
v+ Move cursor: Select by character
v+ Move cursor: Select by Rectangle (select the entire line across the cursor)
14 Find in command-line mode
/pattern forward lookup starting from the current cursor
? PATTERN Reverse Lookup starting at the current cursor
N: Look down
N: Find up
15 find and Replace in last-row mode
S: replace
#, #s/pattern1/pattern2/g replace PATTERN1 all with PATTERN2
#, #s/pattern1/pattern2/i ignore case replace PATTERN1 all with PATTERN2
This article is from the "surgery industry has specialized" blog, please be sure to keep this source http://fuvip.blog.51cto.com/9276123/1980836
Advanced use of the VIM editor