diff options
Diffstat (limited to 'lua/ache/plugins/molten-nvim.lua')
| -rw-r--r-- | lua/ache/plugins/molten-nvim.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lua/ache/plugins/molten-nvim.lua b/lua/ache/plugins/molten-nvim.lua new file mode 100644 index 0000000..44792fc --- /dev/null +++ b/lua/ache/plugins/molten-nvim.lua @@ -0,0 +1,47 @@ +--[[ +-- This plugin can execute Python code inside Neovim. +-- It can be used to enhance the Python Notebook edition from Neovim. +--]] + +return { + "benlubas/molten-nvim", + enabled = true, + version = "^1.0.0", -- Use version <2.0.0 to avoid breaking changes + dependencies = { "3rd/image.nvim" }, + build = ":UpdateRemotePlugins", + init = function() + -- This is an example, not a default. Please see the `README` for more configuration options + vim.g.molten_output_win_max_height = 12 + + -- This guide will be using image.nvim + -- Don't forget to setup and install the plugin if you want to view image outputs + vim.g.molten_image_provider = "image.nvim" + + -- Optional, I like wrapping. Works for virtual text and the output window + vim.g.molten_wrap_output = true + + -- Output as virtual text. Allows outputs to always be shown, works with images, but can be buggy with longer images + vim.g.molten_virt_text_output = true + + -- This will make it so the output shows up below the \`\`\` cell delimiter + vim.g.molten_virt_lines_off_by_1 = true + + vim.keymap.set("n", "<leader>ne", ":MoltenEvaluateOperator<CR>", { desc = "Evaluate operator", silent = true }) + vim.keymap.set( + "n", + "<leader>nos", + ":noautocmd MoltenEnterOutput<CR>", + { desc = "open output window", silent = true } + ) + + vim.keymap.set("n", "<leader>nr", ":MoltenReevaluateCell<CR>", { desc = "Re-eval cell", silent = true }) + vim.keymap.set( + "v", + "<leader>nR", + ":<C-u>MoltenEvaluateVisual<CR>gv", + { desc = "execute visual selection", silent = true } + ) + vim.keymap.set("n", "<leader>noh", ":MoltenHideOutput<CR>", { desc = "Close output window", silent = true }) + vim.keymap.set("n", "<leader>nmd", ":MoltenDelete<CR>", { desc = "Delete Molten cell", silent = true }) + end, +} |