Wednesday, December 30, 2009

Re: accelerate seven (or more) substitute

On 30 déc, 13:41, Christian Brabandt <cbli...@256bit.org> wrote:
> Hi epanda!
>
> On Mi, 30 Dez 2009, epanda wrote:
>
> > foo to change to bar
> > oof to change to rab
> > ofo to change to abr
> > fof to change to arb
> > etc...
>
> > all word are different
>
> let subst['foo'] = 'bar'
> let subst['oof'] = 'rab'
> let subst['fof'] = 'arb'
> let subst['ofo'] = 'abr'
> exe ':%s/' . join(keys(subst), '\|'). '/\=subst[submatch(0)]/g'
>
> regards,
> Christian
> --
> hundred-and-one symptoms of being an internet addict:
> 38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail
>     on the way back to bed.


It is ok, just the I flag to put at the end like this exe ':%s/' .
join(keys(subst), '\|'). '/\=subst[submatch(0)]/Ig' in order toavoid
case problem

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

No comments: