On Mon, 2007-01-29 at 21:57 +1300, John Little wrote:
> Hi
>
> IMHO simpler and more flexible (works if there are lines not matching
> the pattern) is:
>
> :let n=0 | g/opIndex(\zs\d\+/s//\=n/|let n+=1
>
> A useful idiom I learned here. Usually I muck around with ordinary
> searches until the search highlighting shows I've got it right, then
>
> :let n=0|g//s//\=n/|let n+=1
>
> is what I have to remember, and it's obvious what the start and increment are.
>
> John
Just as additional info this method also lets you perform this sort of
incremental substitution on letters.
UniqueID2 = lview.focusedItem.subItems.opIndex(0).text;
Parent = lview.focusedItem.subItems.opIndex(0).text;
Children = lview.focusedItem.subItems.opIndex(0).text;
login = lview.focusedItem.subItems.opIndex(1).text;
let i=97|g/opIndex(\zs\d\+/s//\=nr2char(i)/|let i=i+1
UniqueID2 = lview.focusedItem.subItems.opIndex(a).text;
Parent = lview.focusedItem.subItems.opIndex(b).text;
Children = lview.focusedItem.subItems.opIndex(c).text;
login = lview.focusedItem.subItems.opIndex(d).text;
let i=65|g/opIndex(\zs\d\+/s//\=nr2char(i)/|let i=i+1
UniqueID2 = lview.focusedItem.subItems.opIndex(A).text;
Parent = lview.focusedItem.subItems.opIndex(B).text;
Children = lview.focusedItem.subItems.opIndex(C).text;
login = lview.focusedItem.subItems.opIndex(D).text;
:h nr2char
cheers,
--
Mark