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
| Keys | What they do |
|---|---|
dw | Delete to the start of the next word |
diw | Delete the word, leave the spaces |
daw | Delete the word and one space |
de | Delete to the end of the word |
3dw | Delete 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