I've done this with VIM.evaluate("@*")
To overwrite the selection with the contents of the variable new_text,
I've done:
old_x=VIM.evaluate("@x")
VIM::evaluate("setreg('x',\"#{new_text.vim_escape}\")")
VIM::command(":normal vgv\"xP")
VIM::evaluate("setreg('x',\"#{old_x.vim_escape}\")")
Where vim_escape is defined as follows:
class String
#escapes a string so it can be concatenated into
#a call to VIM.evaluate
def vim_escape
result=dup
result.gsub!("\\",'\\\\\\\\')
result.gsub!('"','\"')
result
end
end
--
Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/