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?
dw deletes from the current position of the cursor to the beginning of the next word. daw deletes the word + trailing whitespace of the word the cursor is on top of regardless of where the cursor is.
dw means "cut from here to next word".
viw - select 'inner' word.
To delete a word, position the cursor at the beginning of the word and type dw . The word and the space it occupied are removed. To delete part of a word, position the cursor on the word to the right of the part to be saved. Type dw to delete the rest of the word.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With