Reputation: 3437
Following vimtutor
tips 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 the difference between dw and de. What's the use case when using dw and de?
Upvotes: 17
Views: 10116
Reputation: 196789
dw
means "cut from here to next word".
before: fo[o]bar baz
dw
after: fo[b]az
de
means "cut from here to the end of the current word".
before: fo[o]bar baz
de
after: fo[ ]baz
Upvotes: 27
Reputation: 113455
Having a buffer like this:
Lorem ipsum dolor
Move the cursor (▒
) in the middle of ipsum
word:
Lorem ip▒um dolor
Now press de:
Lorem ip▒dolor
The cursor deleted the letters from the current word, until end, but without space.
When doing dw, the space will be deleted:
Lorem ip▒olor
Upvotes: 15