Vim is an upgraded version of VI, which is displayed according to the text attributes, with the following details:
General mode:
1. Cursor Positioning:
Move left and right one character, H L
Move one character up or down, K J
Left and right down, around on both sides, down in the middle so remember
Cursor positioned at the beginning of shift+6 ^
Cursor positioning line End shift+4 that is $
Cursor positioned to the first line of text GG
Cursor is positioned to the end of the text line G
The light table is positioned to the nth row NG N is a number
Page Up Ctrl B or PgUp
Page back Ctrl F or PGDN
2. Delete Copy sticky
X Remove one character backwards
X Delete one character forward
DD Delete current in full row
NDD down Delete n rows
YY Copy a row
NYY copy n rows down
P Paste on the next line of the cursor
P paste on the previous line of the cursor
3. Find and replace
/word Press N to search backwards for character word
? Word presses N to search for characters ahead of Word
: n1,n2s/word1/word2/g find word1 between N1 rows and N2 rows and replace with Word2
The slash can be replaced with a # number
: 1, $s/word1/word2/g find to tail line substitution
Two-edit mode
I insert characters in the current character match either
A inserts a character specifier the current character
I insert characters at the beginning of a line
o Insert a new line down
O insert a new line up
Three-command mode
: Wq Save Launch
: q! Mandatory rollout
: wq! Force Save exit
: Set NU Displays line number
: Set Nonu suppress line numbers
U undo the previous action,
CTRL R Redo Undo
Linux Learning Summary (13) Text editor vim