> source of the l:lineToChange -- is this from some larger loop? The
> reason it's confusing is that after you've gone through the loop once,
> I'd expect that TO_SUB_WITH_KEY is no longer in the string, so
> subsequent passes through the loop look like they're just appending the
> same line (which, btw, I'd perform with
>
> put=line
>
> instead of via normal mode.)
>
> My first thought would be to do fewer substitutes, which could be done
> if your hashes are nested, so you have a double-dereferencing.
> Something like
>
> :%s/TSWK1\|TSWK2\|TSWK3/\=s:hash[submatch(0)]/g
>
> or, if you have a bunch of keys, you might be able to do something like
>
> :let @/=join(keys(s:hash), '\|')
> :%s//\=s:hash[submatch[0]]/g
>
> (you might have to escape the keys if there are funky regexp
> metacharacter values in the hash keys)
>
> -tim
Tim, see my first post, l:lineToChange is defined before the loop on
my hash.
In fact,
I prefered concat my xml line before loop and doing mapping
(substitute) into the loop thinking it was faster (but not after
measurement)
I didn't know if exec 'norm o' take a long time, thank you for your
response.
If you have other advises or link I will be glad to apply them.
Thank you Tim
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment