Loading ...
Sorry, an error occurred while loading the content.

Re: insert multitline from ruby script

Expand Messages
  • pierre
    Ahem!... another difficulty The technique =system( ruby /path/to/file ) works nicely apart from a problem: I can no longer access things like VIM::Buffer
    Message 1 of 5 , Mar 15, 2011
    • 0 Attachment
      Ahem!... another difficulty

      The technique   
      <C-R>=system("ruby /path/to/file")
      works nicely apart from a problem: I can no longer
      access things like VIM::Buffer in my ruby script, while
      they work ok if I use
      :rubyf /path/to/file
      on the command line.

      So, what is the proper way to go?
      1) install the required vim-ruby packages on my system
      (but which are the good ones?)
      2) inside my script, require or load the appropriate
      definitions (but where are they? inside macvim?
      inside /usr/share? in some ruby Framework?)
      3) last option: ask the list and let them explain to me
      what I'm missing. I'm sure there is a trivial solution

      Thanks, 
      Piero

      --
      You received this message from the "vim_mac" 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
    • björn
      ... Instead of sytem(...) you can call any Vim function...in particular you can supply your own. For example: function! Test() return hi! endfunction You
      Message 2 of 5 , Mar 21, 2011
      • 0 Attachment
        On 15 March 2011 14:02, pierre wrote:
        > Ahem!... another difficulty
        > The technique
        > <C-R>=system("ruby /path/to/file")
        > works nicely apart from a problem: I can no longer
        > access things like VIM::Buffer in my ruby script, while
        > they work ok if I use
        > :rubyf /path/to/file
        > on the command line.

        Instead of sytem(...) you can call any Vim function...in particular
        you can supply your own. For example:

        function! Test()
        return "hi!"
        endfunction

        You can now <C-R>=Test() and "hi!" will be inserted into the buffer.
        If you need more help with this you should ask on the vim_use Google
        Group.

        Björn

        --
        You received this message from the "vim_mac" 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
      Your message has been successfully submitted and would be delivered to recipients shortly.