Vim Scoops / Lessons / Delete a word

How to delete a word in Vim

Put the cursor on the word and press daw to delete it and the space after it. dw deletes from the cursor to the start of the next word.

The keys

KeysWhat they do
dwDelete to the start of the next word
diwDelete the word, leave the spaces
dawDelete the word and one space
deDelete to the end of the word
3dwDelete three words

iw and aw are text objects: inner word and a word. They work from anywhere in the word, so you don't need to get to the start first.

Swap d for c and you delete and start typing in one go: ciw replaces a word.

Related

Want all of Vim, in order? Vim Scoops is a free game that starts at h j k l and builds up to macros.

Play the full game