kovisoft / slimv

Official mirror of Slimv versions released on vim.org
454 stars 60 forks source link

Launching up R (on Windows) #52

Open some-mthfka opened 7 years ago

some-mthfka commented 7 years ago

Hi! I am trying to use SLIMV for R instead of Lisp, is that doable? I found this in the description: Added support for the R language via swank-R (by Philipp Marek), but I did not find any details. Could you, please, write up some instructions on how to make it work if it is possible? Platform: Windows 7 x64.

kovisoft commented 7 years ago

First of all I must admit that I'm not familiar with R, and all R related stuff was implemented by Philipp Marek (as you can see in the commit message). If you need additional support, I strongly suggest that you contact him, you can find him on github as well: https://github.com/phmarek .

Anyway, I have just installed R and tried to collect the information how to use it with slimv. I did this on Linux, but I think the process is similar on Windows, except the pathnames are different.

(1) Download swankr (swank server for R) from here: https://github.com/csrhodes/swankr to your computer (e.g. in directory /home/username/swankr-master).

(2) Run R and load swankr, pass a filename of your choice for the port file (e.g. /home/username/swankr-port-file):

R --no-save --interactive

> source('/home/username/swankr-master/swank.R', keep.source=TRUE, chdir=TRUE)
> startSwank('/home/username/swankr-port-file')

(3) Run vim and load or create an .R file

(4) Connect to the swank server by pressing ,c in vim.

At this point a new REPL window should be opened and you are ready to evaluate forms (either by pressing ,d on a form in the source window or directly typing a command in the REPL window).

You can also automate the swankr startup process if you create a batch file (e.g start-swankr.bat) that starts R and loads then starts the swank server. Slimv can run this command whenever it needs to connect to the swank server (i.e. when you press ,c). Set this variable in your .vimrc file (of course this is just an example):

let g:slimv_swank_cmd='!start /MIN start_swankr.bat'

some-mthfka commented 7 years ago

@kovisoft Thanks for the answer! I tried it about a couple of days ago and it the repl gave out errors with missing functions. If necessary, I will provide the exact log, but I found that even if I got it to work, using graphics capabilities and looking at graphs would be painful, so I will use a normal IDE. It is great for CL, but not R. Thanks for the help!

kovisoft commented 7 years ago

Then I suggest that you contact Philipp Marek, I think he can give you some advice on using graphics with slimv as well. Anyway, if you want me to investigate those REPL error messages, then please provide the logs together with a description on how you actually started swankr and what you did in vim.