How do I delete from the cursor to the end of a word?
Answer
de
Explanation
The de command deletes from the cursor position to the end of the current word. It combines the d (delete) operator with the e (end of word) motion.
How it works
dtriggers the delete operatoremoves to the last character of the current word- Together they delete everything from the cursor through the end of the word, leaving any trailing whitespace intact
Example
Given the text with the cursor on the q of quick:
The quick brown fox
Pressing de results in:
The brown fox
The characters quick are deleted but the space after the word remains.
Tips
- Use
dwto delete from the cursor to the start of the next word (includes the trailing whitespace) - Use
dewhen you want to preserve the space after the word - Use
d2eto delete through the end of the second word ahead - Use
ceto delete to the end of the word and enter insert mode - Use
dE(uppercase) to delete to the end of a WORD (whitespace-delimited, treating punctuation as part of the word) - If the cursor is in the middle of a word, only the portion from the cursor onward is deleted