Vim Editor
is an upgraded version of VI with color display
Install Yum install-y vim-enhanced
Copy the passwd file to a different directory with no color after vim
General mode
Left and RIGHT ARROW keys or KJHL four keys to move the cursor
N-directional key moves n-bits in a specific direction
CTRL + B or PageUp page up
CTRL + F or PageDown page Down
0 or Shift 6 cursor moves to the beginning of the line
Shift 4 cursor moves to end of line
GG moves to the first line
G move to the last line
NG moves to nth row
X Remove one character backwards
X Delete one character forward
NX removes n characters backwards
DD Delete/Cut the line where the cursor is located
NDD Delete/cut n rows after the row of the cursor (including rows of n rows)
YY the copy cursor is in the row
Nyy to copy n rows (including rows) from the line where the cursor is located
P Paste Down
P Paste Up
U undo up-Step operation
CTRL + R Redo Undo operation
V Press and hold move to select the character. Similar to the shift under word
Edit mode
I enter edit mode, the cursor does not move
I (uppercase i) enters edit mode and the cursor moves to the beginning of the line
o the cursor inserts a row below
O the cursor inserts a row above
A cursor in the latter one
A cursor at the end of row
Command mode
/[word] to find the string after the cursor, press N to continue to find
? [Word] finds a string before the cursor, press N to continue searching
: n1,n2s/[word1]/[word2]/g find word1 between N1 and N2 rows and replace with Word2, no G replaces only the first word1 of each row (in # instead of/)
: 1, $s/[word1]/[word2]/g find word1 in the document and replace with Word2, no G replaces only the first word1 of each row
: W Save Text
: Q exit
: w! Force Save
: q! Force exit
: Wq Save and exit
: Set NU Displays line number
: Set Nonu does not display line numbers
Day8-1 vim