5

This is strangely difficult to figure out. I do not want to delete what is to the left of the cursor, only from the cursor to the end of the line, and the following 3 lines in ONE command. I know I could do d$ and 3dd

2
  • 1
    There's no newline after that fourth The.. line, is there?
    – muru
    Jan 5, 2015 at 19:49
  • That must have been the problem, thanks! I see your solution is valid as well now. Jan 5, 2015 at 19:52

2 Answers 2

10

Actually, 3dd deletes what is to the left of the cursor.

You want 4D.

2
  • 2
    Or, since D essentially is d$, 4d$, the solution that OP arrived at.
    – muru
    Jan 5, 2015 at 19:45
  • Thanks! I actually said, d$ followed by 3dd on the next line, which accomplishes this in 2 commands, but 4D is exactly what I wanted, and is shorted than the 4d$ that I arrived at. Jan 5, 2015 at 19:50
2

Try d:+4 (from here till the beginning of the fourth line from here).

6
  • It does not seem to do exactly what I am asking for, in fact I am not exactly sure how that command is being interpreted, but it behaves a bit unexpectedly. Jan 5, 2015 at 19:37
  • 1
    I figured it out, the answer was d4$ Jan 5, 2015 at 19:41
  • The problem is that d: +4 is not inclusive of the next 4 lines, it only gets the next 3 lines, which was tripping me up. Jan 5, 2015 at 19:48
  • It is, in fact, inclusive, but vim is not able to move the beginning of the fourth line from here when there are only three lines after. Still, I will leave this answer here as an alternate.
    – muru
    Jan 5, 2015 at 19:51
  • 1
    Not completely valid, but still, thanks! Can I interest you in the Area51 proposal on vim: area51.stackexchange.com/proposals/80441/vi-and-vim?
    – muru
    Jan 5, 2015 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .