Replies: 1 comment
-
This is the solution that I have after looking at the source code a little. This in combination with a bit of lua lets me run code cells in a vim.keymap.set("n", "<localleader>ir", function()
require("conjure.client.rust.evcxr").start()
vim.keymap.set("n", "<localleader>lv", require('conjure.log').vsplit, { desc = "vsplit open conjure log"})
end, { desc = "start evcxr for rust" })
---@param lang string the language of the code cell
---@param start integer the starting row
---@param end_ integer the ending row
local run_with_conjure = function(lang, start, end_)
local eval = require("conjure.eval")
local client = require("conjure.client")
local log = require("conjure.log")
local lines = vim.api.nvim_buf_get_lines(0, start - 1, end_, false)
local code = table.concat(lines, "")
client["with-filetype"](lang, eval["eval-str"], {
origin = "arbitrary_code_runner",
code = code,
["passive?"] = true, -- don't trigger virtual text or append to the log (b/c it's buggy)
["on-result"] = function(r)
client["with-filetype"](lang, log.append, { ("// %s"):format(r) }, { ["break?"] = true })
end,
})
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, every so often I write some code in a
qmd
file (which is essentially just markdown. I'd like to be able to start a repl client while I'm in the markdown file to run code in fenced code blocks.idk if I'm describing that very well. I just want to be able to manually trigger whatever happens when I enter a rust or python buffer that starts the repl and adds all the conjure key mappings.
Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions