VI Most original version
Vim modified version, more powerful
Open File
Vim file path (command line mode)
The command line mode enters edit mode:
A append to the current position
I insert forward in the current position
o Edit the next line in the current row
O edit a line at the current position
Save:
Switch back to command-line mode: Press ESC
Press: SHIFT +: Switch to Extended mode
command-line mode common commands:
NG: Jumps to the end of the file, n indicates the number of rows
GG: Jumping to the beginning of a file
$: Jump to end of line
0: Jump to the beginning of the line
YY: Copy
P: Paste (stick to next line)
P: Paste to Next line
N yy: copies n rows, n represents rows, such as 3,4
N p: Paste n rows
n DD: Delete, n indicates a few rows
DD with P: cut operation
U: Undo (Next step)
CTRL + R: Previous step
H: Current screen start
M: In the middle of the current screen
L: Current screen End
/find content Lookup Press N Next
Extended Mode common commands:
ESC return to command line mode
W: Save
Q: Exit
Wq Save and exit
Q! Force quit, do not save
wq! Force exit and save
Replace changes:
S/content to be modified/what to change/(cursor line)
%s/What to modify/what to change/(%: All lines, but only the first one in each row)
%s/What to modify/what to change/g (g: All contents of each line)
Linux editor Vim