The delete ex command will work beautifully.
:+,$d
This will delete all lines from the current +1 to the end ($)
To delete the next two lines, the next range will work, +1,+2 or the abbreviated +,+2
:+,+2d
As @ib, the mentioned command :delete or :d move the cursor to the beginning of the line next to the deleted text. (Even with the installation of nostartofline ). To overcome this, we can execute the normal mode command. `` `` will return to the exact position before the last jump, in which case the command :d . Now our team
: + , + 2 d enter ` `
Or as one ex command
:+,+2d|norm! ``
To make this easier, we complete this with the command:
command! -count=1 -register D :+,+<count>d <reg><bar>norm! ``
Now, to remove the following next 3 lines:
:3D
This command can also take {reg} as :delete and :yank . Thus, deleting the following 4 lines in register a will be:
:4D a
For more information
:h :d :h :command :h :command-register :h :command-count :h ``
Peter Rincker Sep 02 '10 at 19:32 2010-09-02 19:32
source share