Enter the command of VI
Vi FileName: Open or create a file and place the cursor in the first line
VI N FileName: Open the file and place the cursor in the Nth line
VI FileName: Open the file and place the cursor in the last line
VI / PATTERN FILENAME: Open the file and place the cursor at the first string matching with Pattern
Vi -r filename: The system crashes when you are using VI editing, restore filename
vi filename .... filename: Open multiple files, edit
Move cursor class command
H: Cursor left shift a character
l: Move a character right at the cursor
Space: Cursor right shift a character
Backspace: Cursor left shift a character
K or CTRL P: Moves on the cursor
J or Ctrl N: Move a row under the cursor
ENTER: Moves in the cursor
W or W: Cursor right shift one word to the head
B or B: The cursor is left to move one word to the head
e or E: Move a word from the cursor J to the word
): The cursor moves to the end of the sentence
(: The cursor moves to the first sentence
}: The cursor moves to the beginning of the paragraph
{: The cursor is moved to the end of the paragraph
Ng: The cursor is moved to Nth
N : Move N-line down
N-: Move N-line on the cursor
N $: cursor to the Nth row
H: The cursor is moved to the top line of the screen
M: The cursor is moved to the middle line of the screen
L: The cursor moves to the last line of the screen
0 :( Note is a number zero) cursor movement to the current lead
$: Cursor moved to the current end
Screen roll class command
Ctrl u: Topping half screen to file
Ctrl D: Tailing the file half screen
Ctrl f: turn a screen to the file
Ctrl b; turn a screen to the file
NZ: Rolling the nth row to the top of the screen, and roll the current row to the top of the screen when n.
Insert text class command
i: before the cursor
I: in the current lead
A: After the cursor
A: at the end of the current
o: Newly opened in the current line
O: Newly opened on the current line
R: Replace the current character
R: Replace the current characters and the following characters until pressing the ESC button
S: Start at the current cursor location, replacing the specified number of characters in the input text
S: Delete the specified number of rows and replaced by the text you entered
NCW or NCW: Modify the specified number of words
NCC: Modify the specified number of lines
Delete command
NDW or NDW: Remove the N-1 word from the cursor
Do: Delete to the head
D $: Delete to the end
NDD: Delete the current row and after the N-1 line
X or X: Delete a character, X delete the cursor, and X delete the cursor
Ctrl u: Delete the text entered in the input mode
Search and replacement commands:
/ pattern: Search for the file from the start of the cursor Pattern
Pattern: Search Pattern from the beginning of the cursor
N: Repeat the last search command in the same direction
N: Repeat the last search command in the reverse direction
: S / P1 / P2 / G: Alternative to all P1 in the current line
: N1, N2S / P1 / P2 / G: Alternative to all P1 in the nth to n2 lines
: G / p1 / s // p2 / g: Set all P1 in the file with P2 replacement options
All: List all option settings
TERM: Set the terminal type
Ignorance: ignore the case in the search
List: Showing actions (Ctrl i) and row tail sign ($)
Number: Display line number
Report: Displays the number of modified commands
TERSE: Show short warning information
WARN: If you do not save the current file when you go to another file, display no write information
Nomagic: Allows special characters that do not bring "/" in front of the search mode
NOWRAPSCAN: It is prohibited from starting from the other end when searching at both ends of the file
MESG: Allow VI to display other users to write information on their terminals with WRITE
The last mode command
: N1, N2 CO N3: Copy the content between N1 to N2 lines to the N3
: N1, N2 M N3: Move the content between N1 lines to N2 lines to the N3
: N1, N2 D: Delete the content between N1 to N2 lines
: W: Save the current file
: E FileName: Open File FileName for editing
: X: Save the current file and exit
: Q: Exit VI
: Q !: Do not save the file and exit VI
:!! Command: Execute the shell command Command
: N1, N2 W! Command: Use the contents of the N1 lines to the N2 line as a Command's input and execute it, if not
Ding N1, N2, indicating the entire file content as a Command
: R! Command: Put the output of the command Command to the current line.