Open asdf8601 opened 1 year ago
Good idea. I'm new to Neovim as well, and I also want to solve this issue.
I tried what you did and encountered the same error. I realized that this happens when the required keys for each setting in the slime_default_config are not present.
I'm not sure about the initialization process of slime_default_config or when it is initialized.
This solution below will fix the error you reported, but it's not a perfect solution. You will still need to specify the target_pane or jobid by using ctrl+c, ctrl+v
when you switch.
vim.opt.shell = "zsh"
vim.g.slime_target = "tmux"
vim.g.slime_python_ipython = 1
vim.g.slime_default_config = {socket_name="default", target_pane="", jobid=""}
function toggle_slime_target()
if vim.g.slime_target == "neovim" then
vim.g.slime_target = "tmux"
else
vim.g.slime_target = "neovim"
end
end
vim.keymap.set('n', '<Leader>sl', toggle_slime_target)
Hi there,
I think the relevant pieces are
I would say the key to switching target/config:
slime_target
(as per your own code)unlet b:slime_config
if it's setslime#config
(explicitly or implicit) to re-configureLet me know how that goes
For those interested, I create this user command which I put in the init function of lazy.nvim:
vim.api.nvim_create_user_command('SlimeTarget', function (opts)
vim.b.slime_config = nil
vim.b.slime_target = opts.args
end, { desc = "Change Slime target", nargs = '*'})
You can use this as SlimeTarget neovim
or SlimeTarget wezterm
which will be put into the buffer local vim.b.slime_target
.
After this, you can run SlimeConfig
again to be prompted for the new target.
Hi there!
Thank you for the amazing work done here. I'm wondering if there's something that I could do to switch between tmux and nvim in the same session.
My using case is I'm start working in nvim then I start ipython, sending commands and then I have doubts if a code will work the same in my server so I create a new tmux pane, sshing to the server, start a new ipy and then I would like to send the same code block to this new ipython.
I though that it could be done with this:
however, I can't make it works. The first time I've used neovim but when I switch to tmux it raises the following error:
Can be this done? I'm wasting time with this?