Nvim-R icon indicating copy to clipboard operation
Nvim-R copied to clipboard

Nvim-R and Docker

Open pcinereus opened this issue 2 years ago • 4 comments

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?

pcinereus avatar Nov 06 '23 11:11 pcinereus

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

jalvesaq avatar Nov 06 '23 12:11 jalvesaq

Will do - thanks

pcinereus avatar Nov 06 '23 21:11 pcinereus

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.

jalvesaq avatar Nov 08 '23 14:11 jalvesaq

Ok. Will give that approach a try - thanks

pcinereus avatar Nov 08 '23 23:11 pcinereus

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.

jalvesaq avatar Feb 18 '24 15:02 jalvesaq