> > I am doing this job for each line of a 4000 lines files :
>
> > let l:lineArranged = substitute(l:lineArranged, 'foo1', 'BAR1', "")
> > let l:lineArranged = substitute(l:lineArranged, 'foo2', 'BAR2', "")
> > ...
> > ..
> > let l:lineArranged = substitute(l:lineArranged, 'foo7', 'BAR7', "")
>
> Can an item appear more than once (for which you only want to replace
> the first match), or is it okay to use the "g" flag?
>
> If you can do all of them, I'd just use (check for levels of escaping,
> as I'm not sure the "\ze" should be "\\ze"...it's untested, but close
> enough to get you the idea)
>
> substitute(l:lineArranged, 'foo\ze[1-7]', 'bar', 'g')
>
> I see you're still trying to do this with variables rather than dealing
> with lines in a buffer -- you'll find Vim affords many more conveniences
> for working with lines-in-buffers than it does for manipulating
> variables. So I'll continue to urge you to consider changing your
> methodology, even if you continue to disregard it :)
>
> -tim
Tim I don't understand your joke sentence cause I am not english.
You missunderstood my pb cause I was not enought accurate in my
description.
It is not foo1, foo2 to foo7 but
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
About variable or buffer, I don't search for conveniences but for good
response time of my script process.
I believed from a previous post that I had to avoid normal command or
exec 'norm' command and that storing data
into string was more efficient than using visual thing (into a buffer)
like moving or editing commands via normal or exec call
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment