Say I have the text:

This is a test!

If my cursor is on the first character, "T", and then I do d4w, then I am left with just !. However, if instead I do v4wd then I'm left with nothing (i.e. the entire string was selected and deleted).

Why is this the case? I saw there are some special cases with words when searching for an answer, but it doesn't seem to exactly apply from my understanding.

2 Answers 2


In Vim motions can be either inclusive ("include the rightmost character"), or exclusive ("exclude rightmost character"). w is made exclusive (so you delete exactly four words: "this" "is" "a" "test"). If you want to make it inclusive add :h o_v to the target command: d4vw.

Now, in Visual mode all motions are governed by a global option called :h 'selection'. By default, it's :set selection=inclusive, so ! gets into the visual selection. Add :set selection=exclusive to your vimrc if you don't like it.


It's not a special case, the examples are different. In the first one you say "delete 4 words", in the second you say "move 4 words to the right and then delete all that was selected", they mean different things. In the first case the first word to be deleted is This and the fourth word to be deleted is test, in the second case the first word the cursor is moved to is is and that the fourth word is !.

You can see it better by typing 4w in normal mode with the cursor in T, you will see that the cursor is on top of !, just like in visual mode

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.