6

I understand that the right way to delete until the end of line is d$, but why does dt$ not work also?

  • 8
    D would also work, I think. – Simon Richter Aug 15 '16 at 15:36
  • 5
    Start here: :h operator, and keep reading until you reach the end of the file, these are things you'll be using all the time. – Sato Katsura Aug 15 '16 at 17:02
29

Because t takes a character, so it looking for a literal $ character, not a motion like end of line

5

t (and its variants T, f and F) take a single character afterwards to denote the target of motion within the line.

So the effects of the two commands are:

  • d$ - delete to end of current line
  • dt$ - delete up-to-but-not-including a literal $ on the current line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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