iron.nvim icon indicating copy to clipboard operation
iron.nvim copied to clipboard

user specified repl_definitions

Open pcinereus opened this issue 1 year ago • 0 comments

For reproducibility purposes, I regularly run R inside of docker containers both locally and remotely.
My iron.nvim config includes numerous repl_definitions like:

R_in_docker = {
    command = { "docker", "run", "--entrypoint", "R", "-it", "--rm", "r-tidyverse:1"},
},

and corresponding keymaps like:

vim.keymap.set("n", "<leader>rp", function()
   local line = vim.fn.getline(".")
   require("iron.core").send("R_in_docker", { line })
end, { buffer = true, desc = "Send current line to R session" })

Although this does work, it has the following consequences

  1. A need to define a new repl_definition for each docker image or ssh address
  2. A need to define a new keymap for each action like sending a line, paragraph, function, region etc for each repl_definition

Is there a way to get the user to input a command (like "docker run --entrypoint R -it --rm r-tidyverse:1" or "ssh NAME@SERVER R") and have it assign a name for a custom repl_definition that then can be applied to the keymaps. For example, if it named the repl_definition "R", then all the existing keymaps would work.

Sorry if this functionality already exists and I am too incompetent to realise it...

regards

pcinereus avatar Mar 09 '25 06:03 pcinereus