Enter the tutorial in terminal vimtutor:
<ESC> go back to normal mode or undo a command that you don't want to enter/partially complete
H, J, K, l keys move the cursor separately ←↓↑→
Press the <ESC> key after entering normal mode
: q! Exit and discard any changes made to the editor
: Wq save File and exit
I insert text (the cursor refers to the word match either insert)
A add text (added after the cursor refers to the character)
x Delete the character where the cursor is located
DW Delete from the beginning of the cursor to the end of the word and the following space/removed from the current cursor to the next word
De Delete from cursor start to Word end
d$ Delete start from cursor to end of line
DD Delete a row
NUMBER+DD Delete number lines
Number+w move the number word backwards, the cursor starts at the beginning of the word
Number+e move the number word backwards, the cursor is at the end of the word
(number defaults to 1)
0 cursor moves to the beginning of the line
D+NUMBER+W (word) executes number times DW
D+number+e
U Undo Command
p after the last deleted content is placed in the cursor
r+ substitution character replaces the character that the cursor refers to
Ce changes from the beginning of the cursor to the end of the word
C+number+motion Change number Motion range, motion refers to W (word), $ (one line to end of line), etc./actual same as d$ effect
CTRL+G Displays the current cursor line position and file status information
GG cursor jumps to the first line of the file
Number+g the cursor jumps to number line (the default number is 1, the individual G will jump to the first line of the file)
/string Forward Lookup string
? string Reverse Lookup string
After finding the button n means to continue to think after looking, n means looking before;
Ctrl+o indicates the location that was found before returning, ctrl+i means returning a newer find location
Cursor at any one of the brackets, press% can jump between the two parentheses of the pairing
S/old/new replaces the first matching old in the row where the cursor is located
s/old/new/g replace all old in a row with new
: #, #s/old/new/g where #,# represents the line number of the two lines in several rows of the replace operation.
:%s/old/new/g is the replacement of each matching string in the entire file (GG get #; : 1, #s/old/new/g)
:%S/OLD/NEW/GC will find each matching string in the entire file, and the prompt for each matching string is replaced.
: Cursor moves to bottom of screen
:! ! Indicates that external shell commands are allowed to execute
:!command is used to execute an external command.
:! LS indicates execution of external command LS display result
: W test saves the current file with the filename TEST
:! RM Test Delete test File
Move cursor after key v to select target.
Key: After the appearance: ' < ', ' >
Press W filename< Enter >
The effect is to save the selected highlighted part into the filename file
When highlighted, you can do different things, D, C, and so on.
: R filename Inserts the contents of the file at the cursor
: R!ls Inserts the result of the external LS command at the cursor
o The new line under the cursor and into insert mode
O open a new line on the cursor and enter insert mode
A inserting text after the cursor
A at the end of the line where the cursor begins to insert
e cursor at the end of the next word
W cursor at the start letter of the next word
r+* replace the character at the cursor with *
R continuously replaces the letter followed by the replacement mode
Y copy text
P Paste Text
$ to end of line
: Set IC Set ignore case for search
: Set Noic set search ignores case
<TAB> Command Completion
: Help command to find command commands helps
You can create a VIMRC startup script file to save your preferred settings
Vim Operation Summary