Take the 2-minute tour ×
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  

2 Answers 2

up vote 14 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 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
1  
Just use the same convention as the Vim help file: d/<Space>. –  hammar Nov 5 '12 at 12:29

Your Answer

 
discard

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.