Friday, February 22, 2013

Re: moving matched search pattern to after current line

On Friday, February 22, 2013 3:00:49 PM UTC-6, Ben Fritz wrote:
> On Friday, February 22, 2013 12:18:50 PM UTC-6, hackware wrote:
> > I wish to issue a colon command to move a "seeded" search match to after current line.
> >
> > like the following:
> >
> > :'a,'bg/ZZZ/m.+1
> >
> > 'a and 'b are set and around search area containing the "ZZZ" seeded line to be moved...
> >
> > m is for move, and i had thought the period would mean current line, but it does not...
> >
> > and the "+1" would be line after where cursor was before the colon command...
> >
> > Seems simple, what am I doing wrong...?
> >
> > william...
>
> The :g command works by finding a list of lines matching the pattern, setting the "current" line and executing the command on each of the matched lines in turn.
>
> So . in a :g command refers to each line acted on.
>
> For simplicity, I will assume you're moving lines to a position outside of your 'a,'b range. You could either give an absolute number directly, or use :exec 'g...'.line('.'), or set a mark on the current line and use that.

ahhh...

backasswards b my "normal" problem...

did not realize that :g set current line...

guess i'll have to figger out yank/put from registers...
(working up to writing a script...)

thanx...

william...

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment