Passing parameters to Ruby within vimscript...

19 views
Skip to first unread message

Sonny Chee

unread,
Oct 13, 2015, 1:01:44 PM10/13/15
to vim_use
Hey Guys,

I was thinking of invoking Ruby script within a vimscript. Is there a way to pass parameters directly into the Ruby script?

For example, I notice that the VIM::Buffers object has methods for accessing lines of text with the [] operator... .but nothing for accessing the selected range of text (ie: between '< and '>). Writing the parameters out to a file for reading by the Ruby script seems kinda kludgie...


Any insight would be greatly appreciated.

Marc Weber

unread,
Oct 13, 2015, 1:06:33 PM10/13/15
to vim_use
Typically you use the vim API to get values from vim. Eg

let g:xoo= "value"
ruby <<
xoo = vim.eval('g:xoo')
END

or the like

Marc Weber

Sonny

unread,
Oct 13, 2015, 1:10:28 PM10/13/15
to vim...@googlegroups.com
Excellent, thanks for the prompt response Marc.

In case anyone reads this thread, the exact invocation is:

xoo = VIM::evaluate('g:xoo')




--
--
You received this message from the "vim_use" 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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/tAh-NXU_N0I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sonny.
----------------------------------------------------------------------------
Be true to your work, your word, and your friend. Henry David Thoreau.
Reply all
Reply to author
Forward
0 new messages