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

85564Re: putting visually selected text into a string

Expand Messages
  • Vincent
    Dec 1, 2007
      sc,

      I might have a buffer with the following 2 lines:

      x <- rnorm(100)
      plot(x)

      I used A.Politz suggestion (thanks!) and it almost works. The issue is
      that i get an error when i select both lines -- E492: Not an editor
      command: plot(x)"'

      R will accept code segments separated by at ';' but ideally it would
      be a return after each line of R code.

      Best,

      Vincent

      On Nov 30, 11:42 pm, sc <tooth...@...> wrote:
      > On Friday 30 November 2007 23:33, Vincent wrote:
      >
      >
      >
      > > I have the following line in my vimrc file
      >
      > > map <buffer> <F3> :call RunProgram()<CR>
      >
      > > In the RunProgram function i have
      >
      > > let command = getline(".")
      > > execute "!osascript -e 'tell application \"R\" to cmd \""
      > > .command. "\"'"
      >
      > > The osascript stuff allows me on my mac to send R code to
      > > an R terminal.
      >
      > > The issue: if I visually select a number of lines and press
      > > F3 the RunProgram function is run once for each line and I
      > > have to press <CR> to get every line of code send to R.
      > > Very annoying if you are trying to send 50 lines :(
      >
      > > What I would like to do is have the selected lines put into
      > > the string 'command' and have the execute line applied to
      > > that string once. Problem is i don't know how to do that.
      >
      > > Any suggestions?
      >
      > i'll ask the question everyone with answers is wondering:
      > what exactly do you want between what was the selected lines
      > of the buffer as they are passed to osascript?
      >
      > sc
      >
      > > Thanks,
      >
      > > Vincent
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 9 messages in this topic