Have a certain VIM basis can read this article, can quickly query common commands.
Use VIM to install the following three packages
vim-minimal only provides VI and related commands
vim-enhanced provides VIM commands
vim-x11 offers Gvim
VIM has three modes: command mode, insert mode, ex mode
i→ insert mode, press ESC to return to command mode
Command mode:
X: Delete one character of the current cursor
DD: Delete the current line and save the deleted row to the Clipboard
P: Paste after current position
P: Paste before current position
YY: Copy when moving forward
U: Undo
A: Start insertion after current cursor x position (APPEND)
A: Start insertion at the end of the current line
I: Start inserting at the beginning of the current line
O: Insert above current line
O: Insert below current line
GG: Move to first line of document
G: Move to the last line of the document
R: Replace the character at the cursor
~: Change Case
Ctrl + V: block-based
Ctrl+r Recovery undo
V: Character-based
V: Row-based
Ex mode:
: X or: Wq Save and exit
: q! Exit does not save
: w!sudo Tee% forced save
: Anges/pattern/string/flags
Range can be line number, line number range, search condition (/readme\.txt/),%
The common flag is g (replacing pattern on multiple positions in a row) and I (case-sensitive using the current search)
Eg:%s/\<cat\>/dog/gi
Vimtutor VIM Manual
Vim Common commands