-
First add the operation of gedit
- ctrl + z: Undo
- ctrl + c: Copy
- ctrl + v: Paste
- ctrl + t: Indent
- ctrl + q: quit
- ctrl + s: Save
- ctrl + r: Replace
- ctrl + tab: switch
- ctrl + w: Close Tab
-
Vi editor three basic modes
-
Figure
-
The picture shows the conversion between the three modes, according to the arrow marked can switch between the three states, each mode have different functions:
- Normal Mode: The cursor movement, copy, paste, delete;
- Edit Mode: Edit the file
- Command-line mode: Find and Replace
-
Three modes tips
- When not know which mode is, press esc to return to normal mode (regardless of the mode, press the esc key must be returned to the normal mode)
-
-
vi Command Summary
3.1 General Mode
- turn on:
vi + 文件名
- New:
vi + 新文件名
- Save and Exit
:wq
- Exit without saving:
:q!
- drop out:
:q
- After editing should return to normal mode. Save the file
:w
3.2 Edit mode
From the normal mode into the editing mode the following three commonly used keys, press after targeted to different positions:
i
Key, inserted from the front of edit cursora
A cursor inserted from the rear, than the `` `$ rearward command again:o
Open up a new line from the next line of the Bank, and navigate to the beginning of the line
3.3 cursor
- Under normal mode
hjkl
to move the cursor-
H
:left -
J
:under -
K
:on -
L
:right
-
- Under normal mode : to quickly locate a row
- Header:
Ngg
the cursor to the first N trekking (3gg
to line 3) - End of the file:
G
end of Go to File - Specify a row
- Header:
- Under normal mode
-
0
: Locate the beginning of the line -
$
: Positioning the end of the line -
f+x
: Navigate to the next there is ax
place
-
- Under normal mode, text copy, paste, delete, undo
-
yy
: Copy the line (yank) -
nyy
: N-1 and subsequent row diverted replication -
p
: Paste -
dd
: Delete the row -
ndd
: N-1 line and delete diverted back -
u
: Revocation -
x
Delete character position of the cursor
-
- Command-line mode Find and Replace command
- Seek
/+查找字符
- Find Search after:
n
forward searchN
is negative to the search (it is generally the first to jump to the first trekking then search) - Replace 1:
:%s /原字符/新字符/g
: - Replace 2:
:%s /原字符/新字符/gc
- s(substitute); g(global); c(confirm)
- Seek
- turn on:
Linux learning 2-vi Editor
Guess you like
Origin blog.csdn.net/GENGXINGGUANG/article/details/104883230
Ranking