1.1. Mode
- Edit mode
- Input Mode
- Line mode
1.2. Common command
- vi file directly open, can not be changed, the cursor is at the first
- vi + n file opened directly, can not be changed, the cursor is at the n-th row
- vi + file opened directly, can not be changed, the cursor is on the last line
- Move the cursor down commands corresponds to the left and right HJKL
- Move the cursor up and down vertically and horizontally corresponding to the command
- Move the cursor command word W corresponds to a first term
- A command to move the cursor on the word corresponding to the first word B
- Cursor movement command corresponding to a word ending E
- Cursor movement command corresponding to one line of the line 0
- Move the cursor command ^ represents the beginning of a word line
- Move the cursor command $ suffix represents a row
- Gg command to move the cursor to top
- Move the cursor command G footer
- Move the cursor scroll command ctrl F ->
- Move the cursor scroll command ctrl B <-
- X delete character command to delete the character at the cursor position
- Delete command to delete a character nx n characters
- Rn modify character command changes the character at the cursor position
- Delete Rows command dd delete a line of text
- Dw delete word command to delete a word
- Yw Copy command to copy a word word
- Copy the line of command to copy a line yy
- P p Paste Paste Paste command after the cursor before the cursor
- Undo command u
- Restore command ctrl + r
- Repeat Command Repeat last operation
- I cursor input mode is switched to switch the front
- A cursor input mode is switched behind the switch
- O cursor input mode is switched after a new row, the input mode switch
- O cursor input mode is switched before a new row, the input mode switch
- Press esc to enter the last line mode
- Exit q no changes to documents
- Wq save and exit changes, and do not regret it
- Exit q! Exit without saving, mandatory
- Save w
- Force Save w!
- Save and exit shift ZZ wq shortcuts
- Display line numbers set nu
- Hide line numbers set nonu
- Set read-only set readonly
- Find / Find word down
- Find a n
- Find the previous N
- Find? Look up a word
- Execute linux commands! Command +
- Alternatively a word line within s / word1 / word2 word1 word2 replaced
- Alternatively a plurality of words within the line s / word1 / word2 / g word1 word2 replaced
- Alternatively Ignore case s / word1 / word2 / gi word1 word2 replaced
- Alternatively entirety% s / word1 / word2 / g
- Above / can be replaced with a # @
- Deleted text 0, $ d
- Delete the first three rows 0, + 2d