In Linux, Vim is a compiler, there are two modes
Vim initial mode is command mode, there are many kinds of commands in command mode
GG: Move the cursor to the first of the program
G: Move the cursor to the end of the program
8G: Move the cursor to line 8th
DD: Cut
U: Undo
YY: Copy
P: Paste
3yy: Copy 3 lines from cursor
3DD: Cut 3 lines from the cursor
SHIFT4: Moves the cursor from the beginning to the end of the line
SHIFT6: Moves the cursor from the end of the line to the beginning
Shift ~: capitalizes the lowercase letters at the cursor or vice versa
X: Delete the front of the cursor
X: Remove the character at the cursor
W: Jump Backwards in a single word
H: The cursor moves to the left in a single character unit
L: The cursor moves to the right in one character unit
K: Move Cursor up
J: Move the cursor down
5 x: Delete 5 characters in front of the cursor
B: Move forward in a single word
E: Jumps to the end of a line in a single word
yw; copy a word
R: Replace
R: Enter insert mode
2. Insert mode
I: Into insert mode, no change in cursor position
A: In insert mode, the cursor position is changed
O: In insert mode, the cursor will be spaced one line up and down
:/printf cursor directly to printf
: 8 Position to line 8th
: Set Nu Design line number
: Set Nonu undo line number
: vs file name Copy one file to another file
Ctrl+w +h/l jump cursor from one file to another
Pre-processing, compiling, and linking processes under VIM
Preprocessing: using the-e parameter allows GCC to stop the compilation process at the end of preprocessing
GCC-E Test.c-o test.i
Compile:
Gcc-s Test.i-o Test.s
Assembly:
Gcc-c Test.s-o TEST.O
Link:
GCC Test.o-o Test
GDB: Debugging is debugging an executable program
GDB Test starts debugging test
B 8 Break point in line 8th
Info B enters breakpoint
R Run
N Single Step execution
P count can be seen in the debugging process p is worth changing
P &sum can see the sum address during debugging
Delete B Deletes a breakpoint
Vim, GCC, gdb in Linux