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

  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?


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





means "cut from here to the next word."

before: fo[o]bar baz
after:  fo[b]az



means "cut from here to the end of the current word".

before: fo[o]bar baz
after:  fo[ ]baz




All Articles