Hello Tim and all,

Tim Chase wrote on 21.11.09:
 
> 1) bring the "country ___" line down to each non-country line:
> 
>    :v/^country /?country ?t-|s/country //|j
> [...]
> Step #1 is a bit packed:
> 
>    :v/          on every line that doesn't match
>    country      the literal text "country "
>    /            perform this set of actions:
>      ?country ?   look backwards to the most recent
>                   line containing "country "

I think i don't understand this: why do you look *backward* for an occurence of
"country" after you find a line that doesn't contain "country"?
Intuitively i would walk forward through the occurences of "country".

>      t            and copy it
>      -            to the line before this match
>                   ("-" is short-hand for ".-1")

and why do you do this instead of simply deleting *country* in place?

>      |            and then
>      s/           substitute
>      country      the first "country " on the line
>      //           replacing with nothing
>      |            and then
>      j            join this line (the actual country data)
>                   with the next line (the one to which we
>                   are prepending, e.g. "cc")

thank you for enlightening a simple mind.

jan

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

Reply via email to