Hacker News new | ask | show | jobs
by capote 3721 days ago
> For example `daw` will delete a word. To delete a sentence you would `das`.

Huh. I use 'dw' and 'dl'. Why the extra key?

2 comments

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.

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

I'd imagine it's because delete a word is easier to remember. Just sticks in the mind better, if that makes sense.