Thursday, April 29, 2010

Re: Marking lines for deletion

On 04/29/2010 09:23 AM, Ben Fritz wrote:

> 1. mark "start delete" with md (sets mark d)
> 2. move to end of text to delete
> 3. Use the ex command, ":d" to delete the lines, with a range starting
> at your previous mark like this:
> :d,.d

Just to clarify, the mark should have an apostrophe before it:

:'d,.d

Just for clarity of understanding which is the mark and which is
the Ex command, if you use mark "q", it would be

:'q,.d

You can even use marks for both ends of the range to delete,
double-check, move around, copy stuff out, etc, and then delete
them using Ben's method:

1) mark "start of delete" with "ms" (sets mark "s")
2) move to the end and mark the "end of delete" with "me" (sets
mark "e")
3) move around, copy stuff, jump back to the start-of-delete
with 's to check it's really where you want, jump back to the end
with 'e to double-check it, yank some stuff, paste it elsewhere,
drink some $PROGRAMMER_BEVERAGE_OF_CHOICE, surf the web, etc
4) delete the stuff with

:'s,'ed

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: