table of Contents:
- 1.yum tool
- 2.vim editor
-
- (1) How to use: vim [name of written file]
- (2) Transition from normal mode to insert mode
- (3) vim normal mode ==> mobile
- (4) vim normal mode ==> delete
- (5) vim normal mode ==> copy
- (6) vim normal mode ==> replace
- (6) vim normal mode ==> cancel
- (7) vim normal mode ==> change
- (8) vim normal mode ==> jump
- (9) Vim multi-line comments and multi-line comments
- (10) Command line mode command set
- (11) vim replacement string
- (12) Find a string
1.yum tool
(1) yum: package manager, download the software installation package, and install
(2) Yum command:
a. View all software installation packages that exist in the Yum App Store
Yum list can usually be filtered using pipe (|) + grep
b. Install the software package
yum install -y [name of installation package]
eg: yum install -y lrzsz
c. Uninstall
yum remove [installation package name]
d. [Extension]: rz command, sz command
The lrzsz software package installed as an example in b above can upload and download files, not a folder
rz command: upload the win file to the linux operating system, use the rz command in which directory, and upload the file to which folder
sz command:
usage: sz [file name]
transfer files on linux to win operating system, you can choose which folder to transfer to under win when transferring
2.vim editor
vim editor: used to edit text files, and also an editor for subsequent writing of C/C++ code
(1) How to use: vim [name of written file]
vim normal mode
vim insert mode
vim bottom line mode
(2) Transition from normal mode to insert mode
i : Insert to the previous position of the cursor
I (uppercase i) : The cursor will change to the beginning of the current line, and then vim will change from normal mode to insert mode
o : Insert
O (uppercase o) from the next line of the cursor : Insert from the previous line of the cursor
A : The cursor changes directly to the end of the current line, and then vim changes from normal mode to insert mode
(3) vim normal mode ==> mobile
The first method: the up, down, left, and right keys on the keyboard. The
second method: j==>move the cursor down one line
k==>move the cursor up one line
h==>move the cursor to the left
l==>move the cursor to the right
w ==>The cursor jumps to the beginning of the next word
b==>The cursor jumps to the beginning of the previous word, including the word where the cursor is located
(4) vim normal mode ==> delete
dd : Delete a line (essentially cut and paste, if the next operation is to paste, then paste back the content just cut)
[num]dd : delete num line
p (lowercase p) : to the line where the cursor is the next line paste
X : delete the character at the cursor position (single character)
[num] X : delete num characters
X (uppercase X) : to delete a character before the cursor
[num] X- before deleting the cursor of num: character
(5) vim normal mode ==> copy
yy : copy a line
[num]yy : copy num line
p (lowercase p) : paste the content to the next line where the cursor is located
P (uppercase P) : paste the content to the previous line where the cursor is located
(6) vim normal mode ==> replace
r (only replace a single character) : replace the character where the cursor is, move the cursor to the character to be replaced, press r and then press the replaced character
R (can replace multiple characters) : enter the replacement mode, press To replace the character, replace the character where the cursor is. If you don’t want to replace it, you can press ESC to return to normal mode
(6) vim normal mode ==> cancel
Cancel u ==> equivalent to ctrl+z of the win system
Anti-cancel ctrl+r ==> equivalent to ctrl+y of the win system
(7) vim normal mode ==> change
C (uppercase c) : delete all the content of the line after the cursor from the cursor position, which will make vim change from normal mode to insert mode, press ESC to exit
cw (lowercase) : delete the word at the cursor, and make vim from normal The mode changes to insert mode, press ESC to exit
(8) vim normal mode ==> jump
gg : The cursor jumps to the head of the current file
G : The cursor jumps to the end of the current file
[num]G : The cursor jumps to the numth line
ctrl+o (lowercase o) : The cursor jumps to the previous position
(9) Vim multi-line comments and multi-line comments
Multi-line comment: multi-line comment:
a.ctrl+v进入到可视模式
b.使用j或k来选中行
c.按下I(大写i)
d.输入注释的符号"//"
e.按下ESC
a.ctrl+v进入可视模式
b.使用 j 或者 k 或者 g 或者 l 来移动光标选中待删除的行和列
c.按下x
(10) Command line mode command set
a. Delete the line number, add the line number
set nu ==> add line number
set nonu ==> remove line number
b. Open multiple files at the same time (open in split screen)
Enter vs [file name] in the bottom mode
eg: vs test.c
ctrl+ww to make the cursor jump in different split screens
(11) vim replacement string
In the command line mode, if the formula " %s/[string to be replaced]/[string to be replaced]/g "
does not add %, it means to replace the line where the cursor is located.
Add% to mean that the full text
is replaced without g , Which means only replace the first string to be replaced in the
current line. Add g, which means to replace the string to be replaced in the current line
(12) Find a string
a. In normal mode, press'/' and add the searched string after the slash
b. Press n to find the next matching string