nvim: Lazy load molten plugin
This commit is contained in:
parent
1e2246aa51
commit
ebd247e765
2 changed files with 13 additions and 31 deletions
|
|
@ -87,8 +87,12 @@ return {
|
|||
},
|
||||
config = function(_, opts)
|
||||
require("image").setup(opts)
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim")
|
||||
-- if Molten is running, we directly inject the option
|
||||
if vim.fn.exists("MoltenDeinit") > 0 then
|
||||
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim")
|
||||
else
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
end
|
||||
end,
|
||||
ft = { "markdown", "vimwiki", "quarto", "norg", "typst", "python" },
|
||||
priority = 60,
|
||||
|
|
@ -101,7 +105,7 @@ return {
|
|||
{ "3rd/image.nvim", optional = true },
|
||||
},
|
||||
build = ":UpdateRemotePlugins",
|
||||
config = function()
|
||||
init = function()
|
||||
vim.g.molten_image_provider = vim.g.molten_image_provider or "wezterm"
|
||||
vim.g.molten_auto_open_output = false
|
||||
vim.g.molten_virt_text_output = true
|
||||
|
|
@ -126,7 +130,7 @@ return {
|
|||
map(
|
||||
"x",
|
||||
"<localleader>c",
|
||||
":<C-u>MoltenEvaluateVisual<cr>",
|
||||
":<C-u>MoltenEvaluateVisual<cr>gv",
|
||||
{ desc = "evaluate visual", silent = true }
|
||||
)
|
||||
map(
|
||||
|
|
@ -189,33 +193,6 @@ return {
|
|||
keys = {
|
||||
{ "<leader>vn", ":MoltenInfo<cr>" },
|
||||
},
|
||||
cmd = {
|
||||
"JupyterStart",
|
||||
"MoltenInfo",
|
||||
"MoltenInit",
|
||||
"MoltenDeinit",
|
||||
"MoltenGoto",
|
||||
"MoltenNext",
|
||||
"MoltenPrev",
|
||||
"MoltenEvaluateLine",
|
||||
"MoltenEvaluateVisual",
|
||||
"MoltenEvaluateOperator",
|
||||
"MoltenEvaluateArgument",
|
||||
"MoltenReevaluateCell",
|
||||
"MoltenDelete",
|
||||
"MoltenShowOutput",
|
||||
"MoltenHideOutput",
|
||||
"MoltenEnterOutput",
|
||||
"MoltenInterrupt",
|
||||
"MoltenOpenInBrowser",
|
||||
"MoltenImagePopup",
|
||||
"MoltenRestart",
|
||||
"MoltenSave",
|
||||
"MoltenLoad",
|
||||
"MoltenExportOutput",
|
||||
"MoltenImportOutput",
|
||||
},
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
-- Edit code blocks in md/quarto using whatever language is
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ return {
|
|||
cond = true,
|
||||
dependencies = { { "nvim-tree/nvim-web-devicons", config = true } },
|
||||
config = function()
|
||||
-- TODO: Should grab ft directly from molten lazy spec
|
||||
local molten_ft = { "markdown", "rmd", "quarto" }
|
||||
local has_pynvim = -1
|
||||
-- if molten exists, is initialized and connected to a kernel
|
||||
-- show it in the statusline
|
||||
|
|
@ -13,6 +15,9 @@ return {
|
|||
if has_pynvim == 0 then
|
||||
return ""
|
||||
elseif has_pynvim == 1 then
|
||||
if molten_ft[vim.bo.filetype] == nil then
|
||||
return ""
|
||||
end
|
||||
local status_ok, res = pcall(function()
|
||||
return require("molten.status").kernels() ~= ""
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue