Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

In Vim, I know d$, that deletes everything to the end of line.

But how can I delete all text from the current cursor position until the next space? dw doesn't work, since it treats symbols like colon as separator as well.

share|improve this question

3 Answers 3

up vote 15 down vote accepted

dW (capital W) or more generally you can do df followed by the character to search for, in this case space. You can also use t instead of f to delete up to but not including the found character. And if you capitalize the F or T, they work backwards.

share|improve this answer
+1 for dt, d t space worked for me – warl0ck Nov 5 '12 at 6:53
dE deletes to the end of the WORD – Parsa Aug 3 '14 at 21:11

You can also delete until a search string, thus d/<Space> will delete until, but not including, the first space from the cursor position.

share|improve this answer
Anybody an idea on how to escape a space in the code-tics? – Bernhard Nov 5 '12 at 6:52
Just use the same convention as the Vim help file: d/<Space>. – hammar Nov 5 '12 at 12:29

The best (fewest keystrokes) way is


This deletes all text from the current position until the next space. From the help (:h E)

E                       Forward to the end of WORD [count] inclusive.
                        Does not stop in an empty line.
A WORD consists of a sequence of non-blank characters, separated with white
space.  An empty line is also considered to be a WORD.
share|improve this answer
... and what does this do? – muru Sep 27 at 11:28
It does exactly and precisely what the O.P. requested. – Wildcard Sep 27 at 11:34
Holy smokes! It does? I can't believe it! – muru Sep 27 at 11:35
Oh. I suddenly understand the sarcasm...I didn't realize how old this question was when I posted. Sorry, I'm new here.... :( – Wildcard Sep 27 at 11:42
Posting to an old question is not a problem. But posting a command without any explanation is. – muru Sep 27 at 11:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.