This has always bugged me about the w and W motion commands—they seem to work differently when used with the change command than they do when used alone, or with the delete command.

For example, with the cursor on the "q" of this text:

The quick brown fox jumps over the lazy dog.

typing dw results in

The brown fox jumps over the lazy dog.

and typing de results in

The  brown fox jumps over the lazy dog.

(Notice the two spaces between "The" and "brown".)

The yank command also treats w and e differently, as can be shown by comparing yeP:

The quickquick brown fox jumps over the lazy dog.

and ywP:

The quick quick brown fox jumps over the lazy dog.

However, typing either ceslow<Esc> or cwslow<Esc> results in the same thing:

The slow brown fox jumps over the lazy dog.

Is this documented somewhere? What is the logic behind it and how can I predict the results of a command that uses w?

2 Answers 2


It's a special case. Check the documentation for WORD, under "Special case":

Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is on a non-blank. This is because "cw" is interpreted as change-word, and a word does not include the following white space. {Vi: "cw" when on a blank followed by other blanks changes only the first blank; this is probably a bug, because "dw" deletes all the blanks}

Another special case: When using the "w" motion in combination with an operator and the last word moved over is at the end of a line, the end of that word becomes the end of the operated text, not the first word in the next line.

The original Vi implementation of "e" is buggy. For example, the "e" command will stop on the first character of a line if the previous line was empty. But when you use "2e" this does not happen. In Vim "ee" and "2e" are the same, which is more logical. However, this causes a small incompatibility between Vi and Vim.


The difference between the behavior of the motion in cw vs. dw can be explained simply: normally if you want to change a word you're going to leave the whitespace following it, while deleting a word suggests you want the whitespace to also be removed.

If you do want the whitespace to go away for some reason (I do it regularly enough but can't think of an example) then use the aw motion: caw.

  • Just want to add to dash-tom-bang 's answer: caw is good when you want to change the whole word and its tailing space. For some cases if you want to change from the current point to the next word but keep letters before the cursor intact, you can use vwc.
    – Xuan Wang
    Mar 22, 2022 at 2:13
  • @XuanWang the problem with vwc is that it will also replace the first character of the next word. At least under :set sélection=inclusive, which is the default behavior.
    – filbranden
    Mar 22, 2022 at 2:42
  • As an example for caw: if you want to replace lone wolf with werewolf, with the cursor before lone, you can type cawwere. Just typing cwwere would result in were wolf. Jun 29, 2023 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.