1, the VI3 mode
General mode, edit mode, command mode
2. Quick operation
I, I insert: I insert text at the current cursor, I (uppercase I) at the beginning of the insertion
A, a increases: A is entered by the next word where the cursor is located, and a is added at the end of the line where the cursor is located
O, o insert a new line: O Insert text from the next line where the cursor is located; O (uppercase) insert text from the previous row of the cursor
R,r Replace: R replaces the character where the cursor is located, and R will always replace the text of the cursor until the "ESC" is pressed
Number 0: Move to the front character of this line
$: Moves to the last face character of this line
G: Move to the last line of this file
Ng:n is a number, moving to the nth row of this file
GG: Move to the first line, equivalent to 1G
N Enter: Move the cursor down n rows
N Space: The cursor moves backwards n-grid
YY: The line where the cursor is copied
Nyy: The next n line where the cursor is copied
P (lowercase): Paste to the next line of the cursor
P (Uppercase): Paste to the top row of the cursor
U: Undo
Ctrl+r: Redo a previous action
: e! : Restores the archive to its original state
/word: Searching for a string after the cursor for word
Word: Search for a string of word before the cursor
N: Repeat the previous search action
n Reverse the previous search action
X: Remove one character backwards
X: Delete one character forward
NX: Remove n characters backwards
DD: Delete the entire line where the cursor is located
NDD: Delete the down n line where the cursor is located
D1G: Delete all data from the first row of the cursor
DG: Remove all data from the last row of the cursor
: N1,n2s/word1/word2 g: Find the Word1 string between N1 and N2, and replace the string with the meaning of Word2 g for all substitutions
: 1, $s/word1/word2/g: look for the word1 string from the first line to the last line and replace the string with Word2
: 1, $s/word1/word2/g: look for the word1 string from the first row to the last line and replace the string with Word2,c to indicate whether the user is prompted to replace
:%s/word1/word2 g: Full text replacement
: w: Save the edited data
: w! : Force save if File property is read-only
: w filename Save As
: n1,n2 w filename Saves the contents of N1 to N2 as a filename file
: Set NU: Show serial number
Set Nonu: No serial number displayed
: Q: Exit VI
: q! : If you modify the file and do not want to save it, you can force the exit
: Wq: Exit after saving
: wq! : Quit after forcing save to save to the current user's permissions to the file
: x: Save and exit
: R filename: reads the data from another file into the line behind the cursor
2. Vim Additional function
Format: Vim filename uses vim to open files
V: Character selection
V (UPPERCASE): line selection
Ctrl + V: Block selection
Y: Copy to the selected place
D: Delete the selected content
3, multi-file editing (vi open files, not very good, with vim open more useful)
: N: Edit Next file
: N: Edit Previous file
: Files: Lists all files that are currently open by vim
4, Multi-window function (vi without this function, need to use VIM)
: SP FileName: Opens a new window, if Add file, means open a new file in a new window, otherwise two Windows colleague open a file
CTRL+WJ: Press CTRL first, then press W to release the two keys, then press J to move the cursor to the lower window
CTRL+WK: The button is the same as above, the cursor moves to the upper window
CTRL+WQ: Save exit
Vi/vim Learning