Three different modes
Command mode (edit mode): The default mode after opening the editor, you can move the cursor, delete and so on.
^: Jump to the first non-whitespace character at the beginning of a line
$: Jump to end of line
GG: Jump directly to the first line
#G: Jump To Line #
X: Delete a single character at the cursor location
#x: Remove # Characters
DD: Delete the entire line of the cursor
#dd: Delete the line that contains the cursor.
U: Undo Last Action
Ctrl+r: Undo the previous undo operation
Paste operation
If the entire row is deleted
P: Paste below the line where the cursor is currently located
P: Paste Above
If the deletion is not an entire row
P: Paste at the location of the current cursor
P: Paste in front
Copy operation
Yy:
#yy:
Insert mode : Insert, inserting. You can enter it.
exit mode (not in line mode): powerful. To operate as input commands.
In the non-row mode, save the file, named 1.txt.
: W/tmp/1.txt
: 1,7d Delete 1-7 rows
: 1, $d delete the first line to the last row
:., +3. Indicates the current cursor row, +3 means the following 3 rows
% indicates full text
$ represents the last line
Options:
-O: Multiple files are opened at the same time, multiple files are placed horizontally.
Vim Text Editor