Take the 2-minute tour ×

I am looking at the vim help quickref commands for moving cursor. Following lines confuse me because I find both of them working same. Could some one elaborate me difference with an example.

N  w            N words forward
N  W            N blank-separated WORDS forward

Same question is true for e and E as well.

share|improve this question

3 Answers 3

up vote 11 down vote accepted

According to this cheat sheet it would seem to come down to punctuation.

w   jump by start of words (punctuation considered words)
W   jump by words (spaces separate words)
e   jump to end of words (punctuation considered words)
E   jump to end of words (no punctuation)


demo using w

          ss of w

demo using W

          ss of W

Notice in the first demo how when w is continuously hit that the cursor lands on the punctuation, while in the 2nd demo the punctuation is skipped. This is the difference between the lowercase commands and their upper case equivalents.

share|improve this answer
+1 The GIF demos are a great touch. –  Joseph R. Dec 24 '13 at 6:39
@slm: thanks a lot for such a great demo. with such demo no need to read ans as well –  rahul.deshmukhpatil Dec 24 '13 at 13:19

It's actually fairly simple, w just skips to the next word, but any sort of punctuation or whitespace breaks up words. W is like the industrial-strength next-word command, words are only delimited by whitespace, be it tab, space or newline. w stops at the delimiting punctuation also, in case you want to deal with that.

I find the difference useful most often with hostnames:

birdman.cartoons.fictional.com # Fictional host

With w, you stop on each part of the hostname and the dots. W just skips the entire hostname and goes onto the #. These both also apply to d and c for deleting and changing words.

If positioned at the beginning of the above line, if you wanted to replace birdman.cartoons with something else, you would use 3cw to replace both of the first two parts and the dot in the middle. You couldn't do it with W without retyping the whole hostname.

share|improve this answer

It is a difference that is best understood by considering how punctuation can impact on Vim's concept of what delimits a word.

In the case of this example text:

This line is space separated with no commas
however, this line is—note—comma, separated,see

w will happily skip to the first letter of each word in the first line, as there is only space to negotiate. It will fail badly on line 2 with the punctuation, alighting on the first letters of each word and the commas and en dashes. To move from word to word on line 2, you would need to use Shiftw1.

1. Even then, Vim sees "is–note–comma" as a single word.

share|improve this answer

Your Answer


