lkhphuc / jupyter-kernel.nvim

Get (IPython) Jupyter kernel completion suggestions and object inspection into Neovim.
MIT License
75 stars 5 forks source link

Visual Mode #11

Closed euler007 closed 9 months ago

euler007 commented 9 months ago

Hey,

So in visual mode JupyterExecute sends just the last line to the Jupyter console as opposed to the whole visual block.

return {
  "lkhphuc/jupyter-kernel.nvim",
  opts = {
    inspect = {
      -- opts for vim.lsp.util.open_floating_preview
      window = {
        max_width = 84,
      },
    },
    -- time to wait for kernel's response in seconds
    timeout = 0.5,
  },
  cmd = {"JupyterAttach", "JupyterInspect", "JupyterExecute"},
  build = ":UpdateRemotePlugins",
  vim.keymap.set("n", "<leader>[", "<CMD>JupyterInspect<CR>", {desc = "Inspect object"}),
  vim.keymap.set("n","<leader>=", "<CMD>JupyterExecute<CR>", {desc = "Execute object"}),
  vim.keymap.set("v","<leader>=", "<CMD>JupyterExecute<CR>", {desc = "Execute object"}),

}

Here is my config file. Any help is appreciated

euler007 commented 9 months ago

vim.keymap.set("v","<leader>=", "<CMD>'<,'>JupyterExecute<CR>", {desc = "Execute object"}),

Found out the mistake. Visual mode keycap is supposed to be set like this