9. vim Editor
the enhanced version of the Vi editor supports multiple language scripts, file type plugins, text completion modes, and many other options.
Command mode: For file navigation, cut and paste both simple commands. Undo recovery and other operations, also in this mode
Insert mode: For general text compilation, substitution mode is a variant of the insert pattern.
Ex mode : used to save, exit, and open files, as well as search, replace, and other complex operations.
I command mode switch to insert mode, start inserting before cursor
A command mode switches to insert mode and starts inserting after the cursor
I Command mode switches to insert mode, at the beginning of the current line
A Command mode switches to insert mode at the end of the current line
o Command mode switches to insert mode, opening a new line below the current line
O Command mode switches to insert mode, opening a new line above the current line
R starts with the character under the cursor, switches to replace mode, does not insert text, and each character you enter replaces the current document character.
Command-line mode:
K Move up one line
H Move left one row l move right one line
J Move down one line
#h move # characters
^ move to the current start position
$ Move to the current end position
GG moves to the first line of the document
G move to the last line of the document
#G jump to Line #
W moves to the beginning of the next word
b jumps to the beginning of the current or previous word
E jumps to the ending of the current or next word
#w Moving # words
o Absolute Beginning
(Place the cursor at the beginning of the current or previous sentence
) to move the cursor to the beginning of the next word
{The beginning of the current or previous paragraph of the cursor
Move the cursor to the beginning of the next paragraph
Ctrl+f turn down one screen
Ctrl+b Turn One screen upwards
Ctrl+d turn down half screen
Ctrl+u turn up half screen
D Delete text
#dd Delete # lines
D Delete the contents of the cursor to the end of the line
d$ Delete the row of the cursor to the last character of the line
D0 Delete the cursor to the first character in the row
DlG Delete all the contents of the first line of the cursor
DG Deletes the contents of the cursor to the last line
X Delete the character at the cursor
Y Delete text
yy copy entire row
#yy copy # lines
YLG Copy all the contents of the cursor column to the first row
YG Copy all the contents of the row to the last column of the cursor
y0 Copy all the contents of the line to the beginning of the cursor
y$ Copy all the contents of the line to the end of the cursor
P Lowercase Paste when the cursor is behind
P- Caps Paste when the cursor is behind
U Recovery
Ctrl+r Repeat the previous action
. repeat a previous action
/AA Search for this word under the cursor
? Aa look over the cursor for a Aa the string
N repeat the previous search content
N do the opposite of the previous search, such as the previous command? Aa, the word is searched under the cursor.
:100,200s/aa/bb/g the aa between the lines of BB
:1,$s/aa/bb/gc replace aa with BB at the end of the first line , but before replacing it, you should confirm with the user whether to replace it.
Replacement mode (one of the insert modes):
Replace text
Vim allows users to replace large amounts of text with the change command. To use: Press the C key followed by the cursor movement, for example, the CW current cursor position changes to the end of the current word. The text to be replaced is deleted (placed in an unnamed register), andvim switches to insert mode.
CC replaces in a range of rows
The CIW replaces the entire current word
CAW replaces the entire current word with any empty space around it.
C $ replaces the end of the line.
ESC insert mode switch to command mode
Ex mode:
:wq Save Exit
:w save does not exit
:w<aa> Saves the current file with a file name of AA
:q exits the current file
:q! Force exit of the current file
Summary of COMMON commands for LINUX vim compilers