Quick delete
Recall the last lesson
- It was previously known that it can be used in the inserted statedel、BackspaceDelete
-
Now we know that by default
x
Delete character-
Can be in
x
Front use[count]
Double- as
10x
- Deleted characters are stored in
""
Register - Can use
:reg
View register status
- as
-
-
The default state can be used
X
Backspace- Deleted characters are also
""
Register
- Deleted characters are also
- We have mastered various methods to delete characters in VI
- What else is there in the back?
Delete character
- We found that DD can delete a row
- have a try?!
Deleted content
- Where do you put the deleted things?
:reg
- Put it in the default register
""
inside - You can also add
[count]
Double 5dd
You can delete 5 lines. After deletion, you can still put the deleted content in the""
register- So this D
{motion}
What does that mean?
Sports help
- We can check
motion
My documents!!! h motion
motion
Cursor movement-
Like us
G
Just go straight to the last line of the documentdG
Is to delete from the current position of the cursor to the last line. It’s great!
-
gg
It’s the first linedgg
It is deleted from the cursor position to the beginning!!!
ggdG
Is to delete from beginning to end-
8G
It’s line 8d8G
It is deleted from the cursor position to line 8- What if there are only four lines in total?
- If there are four lines in total,
8G
It’s the last line of the road - So, at this time
d8G
What is it, you know?
- Give it a try
Up, down, left and right
- How does the cursor move
hjkl
- These are
motion
- If the front is
d
-
such as
dj
- D stands for deletion
- J move to next line
- DJ represents deletion from the current cursor line to the next line
- Delete two lines in total
-
such as
dl
- Delete current cursor character
- that is
x
-
such as
dh
- Deletes the character in front of the current cursor
- Backspace
- that is
X
Doubling factor
-
If
d8j
d
Is to delete8j
From the current cursor position to the bottom8
that ‘s okd8j
Deleted everywhere
- alike
d7k
d
Yes delete7k
It’s seven lines up- 8 lines in total together with the current line
- It’s all deleted from this scope
-
Think about it
d8h
、d4l
What are they?
Delete by word
-
wbe
Remember what that means?- If you don’t remember, just
h w
- If you don’t remember, just
-
If the cursor is at the beginning of the word
w
It’s to the next oneword
Beginning ofb
It’s the last oneword
Beginning ofe
Yes to the currentword
The end of
practice
-
So we know
dw
Delete from current location to nextword
The beginning of (including the middle space is deleted)d3w
Yes, delete from the current location to the next 3word
Beginning of3dw
Is done from the current location3
seconddw
3d2w
Yesd2w
do3
secondde
Delete from current location to current locationword
End of (no spaces removed)d4e
Yes, delete from the current location to the next 4word
End of (including current word)db
Is to delete the previousword
d2b
It’s the front2
Word
- The above is the current cursor at the beginning of the word
- If the current cursor is in a word?
Cursor in word
-
If the cursor is in the word
w
It’s to the next oneword
Beginning ofb
Yes to the currentword
Beginning ofe
Yes to the currentword
The end of
- Delete it wherever you move it!
- B is to retain the current cursor character and delete it forward
- You have to pay attention to this
word
andWORD
Differences between
Big words and small words
-
Definition of big and small words
word
Include spaces and various punctuation as separatorsWORD
Only spaces are recognized as delimiters-
such as
text-indent
- namely
3 words
- Also
1 word
- namely
dW
You can delete this directly. This is very convenient, especially when there are many underscores in the identifier
- It’s no use talking about the sky. You have to practice this!
Beginning and end of line
-
Wardrobe
- ^Is the first non empty character to the line
- 0Is the first character of the line, whether it is a space or not
-
End of line
- $Skip to the last character of the line, even if it is a space
- g_Is the last non empty character to the line
- Press the two keys in turn
- If you forget, you have to
:h
Check it out
-
Delete?
d^
It is to delete the first non empty character on the line and keep the current characterd0
That is, delete the first character of the line from the current position (whether it is a space or not), and the current character is still retained2d^
Is tod^
implement2
In fact, it’s no different from executing it once. Delete one lined2^
namelyd
reach2^
andd
reach^
, in fact, the same, or delete a line- d $Delete from the cursor to the end of the line, including the current character where the cursor is located
- d $There is another wayD
Delete to end of line
:h D
- DItself isd $
- The positioning method also includes in-line search
In line lookup
- adoptfoJust jump to the right
o
character -
dfo
From the current positiond
reachfo
Location offo
The position of is forward from the current positionf
The second day of arrival1
individualo
Location of- The current character of the cursor is also deleted
-
d2fo
From the current positiond
reach2fo
Location offo
The position of is forward from the current positionf
The second day of arrival2
individualo
Location of
-
2dfo
Is todfo
implement2
Timesdfo
From the current positiond
reachfo
Location offo
The position of is forward from the current positionf
The second day of arrival1
individualo
Location of
- The two results are actually the same
Reverse lookup
- Reverse lookup is
F
-
dFo
Delete from current location toFo
Location ofFo
The location of is found in reverse from the current locationF
The first1
individualo
Location of- The character of the current cursor is reserved
-
dF2o
The location of is deleted from the current location toF2o
Location ofF2o
The location of is found in reverse from the current locationF
The first2
individualo
Location of- Current character retention
-
2dFo
Is todFo
implement2
TimesdFo
From the current positiond
reachFo
Location ofFo
The location of is the reverse search from the current locationF
The second day of arrival1
individualo
Location of
Coordination repetition
- . you can repeat the last operation
- DF >
- . is to execute DF > again
- Can be in
oeasy.java
Practice inside
Intra line attachment
- except
f
Besides, we havet
-
f eIs to move the cursor to
e
above- Yes, jump to
-
t eIs to move the cursor to
e
Above previous characters- It’s close to
-
dt(
Delete from current location tot(
t(
It means close to(
t
Who is who you want to stick to
- Can this be doubled?
Close double
- sure!
- This can also be passed
[count]
Double - 2 to
till
2ndo
- D2to can be deleted to the red L
- D3to can be deleted to purple W
- Not only can it double
- And it can be repeated.
- Use it when you can’t see the distance clearly.
Jump and lean
-
and
f
Related is jumping- towards
front
Jump isf - towards
after
Jump isF
- towards
-
and
t
Related is the attachment- towards
front
Close yest - towards
after
Close yesT
- towards
-
and
a lowercase letter
Related isforward
forward
Jump isfforward
Close yest
-
and
Capitalize
Related isbackward
backward
Jump isFbackward
Close yesT
Full text search
- The two commands for full-text lookup are/and?
-
d/Code
How?- Pressd, note the status bar
- /Then the status bar displays only
/
- input
Code
Pay attention to the status bar - Search in the text
Code
And highlight - Press
enter
Move from the current cursor to the highlightedCode
Location of
- Reverse search is?
-
It can be doubled
[count]
Are you?- tolerable
3d/Code
- tolerable
- And you can.Duplicate find delete
- Try it!!!
Text block
- Use {,} to move the cursor back and forth
- Use (,) to move the cursor back and forth
- have access to
[count]
Double :h }
To view the document
- These are also
motion
Can andd
coordination - such as
d{
、d3)
summary
- We reviewed the whole subject in a big way
motion
: -
Direct movement
- h j k l
-
Line movement
- First lineg g
- Last lineG
- Line nn G
-
Word movement
wbe
- wIt’s to the next one
word
Beginning of - bYes to the current
word
Beginning of - eYes to the current
word
The end of - except
word
BesidesWORD
- wIt’s to the next one
-
Beginning and end of line
- ^Is the first non empty character to the line
- 0Is the first character of the line, whether it is a space or not
- g_Is the last non empty character to the line
- $Skip to the last character of the line, even if it is a space
-
Intra line jumping and clinging
- towards
front
Jump isf - towards
after
Jump isF - towards
front
Close yest - towards
after
Close yesT
- towards
-
Full text search
- If you look for it/
- Reverse search is?
-
Text block
- {、}Move by paragraph
- (、)Move by sentence
- these
motion
FinedIt can be used together to complete the work of rapid deletion - It can also be used in the process
[count]
Double - Delete the content and put it in
""
Register - Can be repeated.
- Then delete this thing
- Put it in the register
- I want to paste it somewhere else
- What shall I do?
- Next time
[GitHub address](https://github.com/overmind19…)
[gitee address](https://gitee.com/overmind198…)
[blue bridge experimental building invitation code fjwyimgb](https://www.lanqiao.cn/course…)