I know that I can delete from the cursor till and including the first occurence of a character x with dfx. This only works on one line. How can I delete from the current cursor position till the first occurence of x when x is not in the same line?

E.g., if the cursor is after the first space in

yada yada yada
yada yada yada x

and I type dfx the result needs to be:


  • 2
    in your example you seem to want to remove until the last occurence of x
    – guillem
    Commented Oct 23, 2015 at 4:55
  • @guillem you're right. That was a copy-paste error. Anyhow, I tried to accomplish what I asked on the example with the error, but did not manage to do so. I asked another question: delete from cursor till nth occurence of character x. Commented Oct 23, 2015 at 9:05

2 Answers 2


Use / for forward search:


and ? for backward search:


I wanted to comment on romainl's answer, but I don't have enough reputation to do so yet!

Although it needs one more keystroke, I find it useful to do v/x<CR>d to see the portion that is being removed.

  • 2
    That's a valid answer. No need to put it in a comment. We're only talking about one piece of software (with its variations), so you don't necessarily need to get fancy to have a valid answer-worthy answer.
    – Wildcard
    Commented Oct 23, 2015 at 7:17
  • @ErwinRooijakkers you should select this answer if this is what you'll now use.
    – Paul Evans
    Commented Oct 23, 2015 at 16:03
  • @PaulEvans I don't agree. Although this answer has more practical value for me, I think that the accepted answer provides a better answer to the question asked (since it does exactly what is requested -- I did not ask to see the text highlighted first). Commented Oct 23, 2015 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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