Vim simple and practical & write code with VIM
VI 1.c set up 1.c to enter terminal instruction mode
Press ESC to enter instruction mode
Press ESC and press: Enter command line mode
Press I to enter edit mode (Press I to enter, the cursor does not move.) Press A to enter, the cursor goes backward one)
After entering edit mode, you can only use the keyboard to operate
Exit after editing, save in exit
Press ESC to enter command mode >: > Wq (w = save, q = exit)
Note: command line > q! Indicates forced exit, not saved. Use caution.
vim 1.c file exists, then open 1.c
Some instructions:
ESC enters instruction mode:
DD deletes the cursor in the row
5DD Delete currently selected down 5 rows
U return
YY the copy cursor is in the row
4YY copy cursor down 4 lines
P The next line of the cursor is pasted
SHIFT + 4 cursor positioned to end
Press 0 directly after ESC
SHIFT + END of paragraph 0
SHIFT + 9 Segment Header
SHIFT + G last line
SHIFT + 3 Move the cursor up
GG Cursor is positioned to the top of the file.
Vim Display line number
ECS enters command line mode
Enter set Nu to display line number
Enter set none hidden line number
The command mode directly presses the number, determines the bit to the corresponding line
Enter command line mode
Vim Writing code
VI 2.c
GCC 2.c compile connection, generates a.out results
./a.out Running Results
##### #代码高亮方法 ######
CD ~ Go to home directory
Setup configuration file: Vi. VIMRC
In the configuration file, enter:
Syntax on
Set tabstop=4
First line: syntax highlighting
Second line: Set Tab key is 4 spaces
Save Exit Esc:w Q
When you open the code, the color is displayed
Terminal simple to write code using &vim