1

I'm using Sublime text 3, and I'm trying to get SublimeREPL to print R files output in the interactive mode that is already open, without reopen a new interactive session every time I modify the .r file and hit cmd + B

I followed sblair procedure for Python here and created R.sublime-build file with the following parameters:

{
"target": "run_existing_window_command", 
"id": "repl_r",
"file": "config/R/Main.sublime-menu"

}

and modified a default line in Main.sublime-menu:

"osx": ["R", "--interactive", "--no-readline"]

into:

"osx": ["R", "--slave", "-f", "$file"]

Now every time I hit cmd + B, I get a new window, with the output by itself!

I couldn't figure out how to make the same window that runs the interactive session to print the output stay running

Note: I know that I can just switch to the prompt window and type >source("FILE") every time I change something, but I want to know if there's a way as easy as making changes to .r file, hit some shortcut, voalla your output is in the same prompt window you were working on.

Community
  • 1
  • 1
7kemZmani
  • 658
  • 1
  • 8
  • 21

1 Answers1

0

If i understand correctly..

Yep, there is, just bind "command": "repl_transfer_current", "args": {"scope": "file"} to a key and when you hit that key it will pass your current file to the REPL prompt for that file.

What i do, that is even better, i got:

{ "keys": ["super+r"], "command": "build" },
{ "keys": ["super+b"], "command": "repl_transfer_current", "args": {"scope": "file"} },

So i can build in the Sublime console with Cmd-R and in the REPL with Cmd-B.

Hope it helps!

Ghost
  • 1,426
  • 5
  • 19
  • 38
  • I made that keybinding, and I'm getting a promote saying "Cannot find REPL for 'r'" – 7kemZmani Mar 09 '16 at 06:13
  • I'm afraid this feature is not even implemented as [this answer](http://stackoverflow.com/a/33038545/834359) suggests .. – 7kemZmani Mar 09 '16 at 06:16
  • You have that warning, because you have to open a REPL prompt, while you have your open file in Sublime on focus; select the panel where your file is open and then open a REPL console, that's what i meant when i said "to the REPL prompt for THAT file". – Ghost Mar 10 '16 at 16:34