On 15-Feb-13 09:24:11 +0100, Nathan Hüsken wrote:

> Hey,
> 
> For doing libclang assisted re-factoring (renaming of symbols), I want
> to replace the symbol name at given locations with the new symbol
> name.
> 
> Now, the locations are given as (fileName,line,column). I could issue
> the editor commands to:
> 
> * edit fileName * jump to (line,column) * delete old symbol (I know
> how long it is) * insert new symbol
> 
> While this would work, it would pollute my jump list. So I am
> wondering, what would be the best way to replace words at a given set
> of locations without any side effects like polluting the jump list?

I would use getline() in a loop over the positions and perform the replacement
with either substitute() or strpart() (probably the latter when I already have
the byte indices). Then write back the result with setline(). This avoids all
side effects.

-- regards, ingo

PS: Such questions are better directed to vim_use.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui