Create a new file in the shell
# Vim A.txt
VIM has three modes: General mode, insert mode, bottom line mode
Three modes of operation
1. Command mode
Move cursor
Hjkl
YY copy
NYY copy n rows from cursor down
0 move the cursor to the beginning of the line
$ move cursor to end of line
Move the cursor quickly
GG to the beginning of the file column
NG moves to nth row
G to end of file header column
P Paste
NP pastes the current line down n times
DD Delete/Cut cursor in the row
NDD Remove/Cut n rows from current
W cursor moves to the first character of the next word
e cursor moves to the last character of the next word
The B cursor moves to the first word in the previous
CTRL + F Turn one screen forward
CTRL + B turn back one screen
R replaces Cursor current character
R continuous replacement cursor, ESC end
U undo
Ctrl + R Recovery
Enter insert mode
I insert before the cursor
I Line Header Insertion
o Create a new row on the next line
O Create a new row on the previous line
A after the cursor is appended
A append at the end of a row
s deletes the character of the cursor and inserts
S deletes the current line and inserts
/search for string n down one, n up one
? Search for string n down one, n up one
2. Insert mode (edit)
Write the content, Note: All character commands in the general mode are invalidated.
3. Bottom-line mode
: Set Nu[mber] Displays line numbers
: Set Nonu[mber] does not display line numbers
: W Save
: Q exit
: Wq Save exit ZZ Shortcut key
: q! Force exit
: N Moves the cursor to the nth row
A concise tutorial on vim