jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
968 stars 126 forks source link

Nvim-R and Docker #768

Closed pcinereus closed 9 months ago

pcinereus commented 1 year ago

I would like to be able to have Nvim-R run R in a docker container to help with reproducibility of the code that I write. However, I am finding a working config elusive. With the following:

vim.g.R_app = "docker"
vim.g.R_cmd = "R" 
vim.g.R_hl_term = 0
vim.g.R_args = { "run -it --rm", "--entrypoint 'R'", "--ipc host my_image:latest"}  
vim.g.R_bracketed_paste = 1

R starts up in the Docker image in a new nvim window - great. However, if I attempt to send any code to this instance, I just receive a message of Not ready yet.

I have seen https://github.com/jalvesaq/Nvim-R/issues/259 and at the very end there is a request for summary of how to setup Docker and Nvim-R. Has anyone worked out a setup/config for this?

jalvesaq commented 1 year ago

I have never used docker, but, perhaps, you could adapt the instructions from remote_access.md. Please, report here if you have success.

pcinereus commented 1 year ago

Will do - thanks

jalvesaq commented 1 year ago

Note: knowing nothing about docker, It seems that you are using R outside docker to build nvimcom (R_cmd) and, then, running R within docker (R_app). Perhaps this would work:

vim.g.R_app = "dockerR"
vim.g.R_cmd = "dockerR" 
-- vim.g.R_args = DON'T SET R_args

Then, create the shell script dockerR in a directory that is in your $PATH and make it executable:

#!/bin/sh
docker run -it --rm --entrypoint "R $*" --ipc host my_image:latest

This still will not be enough if R running within docker cannot access the same $NVIMR_COMPLDIR and $NVIMR_TMPDIR directories that Nvim-R can access.

pcinereus commented 1 year ago

Ok. Will give that approach a try - thanks

jalvesaq commented 9 months ago

Nvim-R is being superseded by R.nvim, a new project that will be inaugurated in a week at the R-nvim organization. Please, check out tmp-Nvim-R and help us to find the last remaining bugs before R.nvim inauguration. When the project is officially started, you will be able to open issues there and request new features.

Nvim-R will remain alive as a feature-frozen project for Vim users. If you want to know the reason, please, see this discussion.