On 26/11/09 14:11, Tim Chase wrote:
>>> :g/^Lesson \d\+//^Abstract/;/^...@!/t$
>>
>> I think it has solved my first problem, it's amazing~~
>
> Glad it mostly worked for you :)
>
>> but I can't understand the expression very well, could you
>> give me some more explanation about how you organize  the
>> command and what every part stand for?
>
> That's
>
>    :g/           On every line that matches
>    ^Lesson \d\+  "Lesson" at the beginning of the line
>                  followed by one or more digits
>    /             perform the following action(s)
>                  [1]
>    /^Abstract/   From the current match's line, search
>                  forward for the word "Abstract" at the
>                  beginning of the line
>                  [2]
>    ;             through [3]
>    /^...@!/       the next line that doesn't start with
>                  a dash
>    t             copy it ("it" = the range from "Abstract"
>                  through the next non-dash line)
>    $             to the end of the file
>
>
> Notes:
[...]
> [3] This was my side-note/complaint in my previous email...I'm
> not really sure why this doesn't work with a "," instead of a ";"
> because I'm fairly certain I've done stuff almost exactly like
> this before using the comma and it's worked.
[...]

The difference is explained under ":help :," which is also ":help :;" (a 
few lines below ":help [range]")

If you separate the "from" and "to" parts of a range by a comma, any 
search in the "to" part starts at the current cursor (i.e., at the same 
place as a search in the "from" part). If you use a semicolon, a search 
in the "to" part starts at the line defined by the "from" part.


Best regards,
Tony.
-- 
hundred-and-one symptoms of being an internet addict:
228. You spend Saturday night making the counter on your home page
      pass that 2000 mark.

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to