What's the difference between de and dw in vim?
Following the advice vimtutor
, I found the following in lesson 2.3:
Many commands that text are made from an operator and a motion.
The format for a follows:
d motion
Where:
d - is the delete operator.
motion - is what the operator will operate on (listed below).
A short list of motions:
w - until the start of the next word, EXCLUDING its first character.
e - to the end of the current word, INCLUDING the last character.
$ - to the end of the line, INCLUDING the last character.
However, I don't see any difference between d wand d e. What is used in the use case d wand d e?
+3
source to share
2 answers
Having a buffer like this:
Lorem ipsum dolor
Move the cursor ( ▒
) in the middle of a word ipsum
:
Lorem ip▒um dolor
Now press d e:
Lorem ip▒dolor
The cursor has deleted letters from the current word to the end, but without a space.
When executed, the d wspace will be removed:
Lorem ip▒olor
+6
source to share