6

I have a file that looks like this:

Bunch of text      trailing...
Bunch of text      trailing... 
Bunch of text      trailing...
Bunch of text      trailing...
Bunch of text      trailing...

I can use C to remove the trailing... text, but that puts me into insert mode; Is there a way to delete to the end of the line without leaving normal mode?

  • 2
    What do you mean by kill? Is d$ what you're looking for? – grodzik Jan 26 '17 at 22:25
  • Seems like an easy find in the man page – user9674 Jan 27 '17 at 3:37
  • 2
    Actually, I would suggest to go through vimtutor ;) – grodzik Jan 27 '17 at 13:43
  • @grodzik soz, it's a term from the heretical Emacs: it's the same thing as clearing to EOL. – Alexej Magura Jan 27 '17 at 17:03
  • @grodzik @DoritoStyle I was using vim on my phone; I don't know if the app supports vimtutor; I'm pretty sure it doesn't offer man pages, though. – Alexej Magura Jan 27 '17 at 17:05
16

Yes. You want to use the "delete" operator instead of the "Change" operator. The delete operator is

d<motion>

and it deletes everything that <motion> moves over.

In this case, the motion you want is $ which moves to the end of the current line. Of course, you may also use D which is simply a shortcut for d$

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.