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.

I have to declare subst like that I think : let subst = {}

I think this command is very powerful, I didn't know this combination
of (join and other stuff).

You script says to me that the key OOF does not exist in the
Dictionnary. E476.

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

No comments:

Post a Comment