Is there any difference between dw and daw in Vim?

Viewed 4860

When I delete a word, I use dw, but I found out that there is daw, which can be memorized as “delete a word”.

Is there any difference between dw and daw?

2 Answers

From the documentation:

For example, compare "dw" and "daw": "dw" deletes from the cursor position to the start of the next word, "daw" deletes the word under the cursor and the space after or before it.

:h daw

you will see more information.

"dw" deletes from the cursor position but the "daw" deletes the word under the cursor.

"daW" delete a WORD

:h word

A word consists of a sequence of letters, digits and underscores, or a
sequence of other non-blank characters, separated with white space (spaces,
tabs, ). This can be changed with the 'iskeyword' option. An empty line
is also considered to be a word.

:h WORD

A WORD consists of a sequence of non-blank characters, separated with white
space. An empty line is also considered to be a WORD.

Related