Hacker News new | ask | show | jobs
by shadeless 3722 days ago
Using 'dw' deletes from the cursor until the end of the word.

Using 'daw' deletes the whole word "around" the cursor (hence 'a' command) - meaning you don't have to pay attention to the cursor position, it could be on the start/middle/end of the word and the result would be the same.

1 comments

Ah. Now I look like I'm vim-dumb.
No worries. There's always more to learn. `dw` is a motion command as in "delete to the end of the word. `daw` is a text object command as in "delete a word." There is also a difference between `daw` and `diw`, which is delete inner word, and `daW` which is delete a WORD.

See http://vimdoc.sourceforge.net/htmldoc/motion.html#object-mot...

and

http://vimdoc.sourceforge.net/htmldoc/motion.html#word