On 27/12/08 23:25, Anton Sharonov wrote:
> Tony Mechelynck wrote:
>> Unless you want to keep the result after displaying it, you
>> could also use the VIM::message() function to display the
>> message in Vim directly from Ruby.
>
> Yes, I want to keep the result. And no, I don't really need to
> display this result, at least in the "raw" form - the "echom" in
> my simple example is just for convenience of testing. My real
> goal is not to just print the message, but rather to post-process
> it using existing set of VIML functions. Just to mention several
> examples, some of those VIML functions are filling location list
> of the current window with entries, extracted from the string,
> returned by TestStringIf(). TestStringIf() is also invoked from
> 'completefunc' to get the information for the user-defined code
> completion.
>
> Generally speaking, TestStringIf() acts as a "protocol
> implementation" for existing library of VIML functions.
>
> So, my TestStringIf() must somehow takeover the string from the
> ruby string variable and make it available in the VIML string
> variable. What I don't like in my existing solution, that there
> is potentially expensive processing of the string - decorate /
> parse (I mean "decorate" is gsub(), "parse" is VIM::command("let
> ...")). Are there any way to avoid this "overhead" ? Something
> like "raw assign VIML variable from the ruby variable" ?
>
>> see ":help if_ruby.txt".
> This I have already studied - ":help ruby" drops me on the same
> page as ":help if_ruby.txt". Are there any other documents /
> howto's for vim ruby integration ?
That one ought to cover everything that is specific to Ruby. It may
include hotlinks to e.g. if_perl.txt for things common to all five
interpreted languages: e.g. ":help script-here" about how to bypass
here-documents when a given language is not compiled-in.
If you have a large amount of text that you want to post-process you may
want to store it in a buffer; for a variable, I believe
VIM::command("let foobar = 'value'") is the right way to do it. You may
of course want to use some more complex Ruby expression as the argument
of VIM::command().
Best regards,
Tony.
--
God is a comic playing to an audience that's afraid to laugh.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---