Closed zippeurfou closed 1 year ago
@zippeurfou hey there and thanks for reaching out! I'm unfamiliar with vim-slime, but I took a look at this repository: https://github.com/jpalardy/vim-slime
If that's the right one, it seems that it supports any interface that you can send text to such as a REPL. If that's the case, then you should be able to use the v0.2 branch to do this via distant. It supports spawning a shell on the remote machine that is exposed via a neovim terminal. You might be able to use it in combination with the neovim terminal support.
With the v0.2 branch, you can spawn a terminal for a specific program via :DistantShell /remote/path/to/python
. It just runs the distant cli in a neovim terminal, so I imagine you could just use it in a similar way to :terminal
in neovim?
For the other plugins, you'd need some way to hook into how they access files/programs. If you can configure a custom program, then they can be set up to use distant.
Underneath, this plugin's v0.2 branch just calls the distant CLI by default to send data to the remote server and respond.
Thanks for the quick answer. I actually use iron.nvim (https://github.com/hkupty/iron.nvim) but thought nvim slime was more popular. My bad ahah. I think from what you’re saying it’s basically doing a lua function that start a remote shell and then specifying it with whatever plug-in you use. Thanks. I will look for the other one. Much appreciated.
Yes. I just added a function to make this a little easier. With iron.nvim, it looks like you would want to specify the repl definition to be the distant cli that will act as the remote program.
Use require('distant.state').client:shell():to_cmd({ cmd = 'python' })
. The client is only available if you have used DistantLaunch
or DistantConnect
to establish a connection to the remote machine. I may expose this in a more friendly manner later, but you can try this out for now.
-- The following would print out the command that can be run locally to run python on your remote machine
print(vim.inspect(require('distant.state').client:shell():to_cmd({ cmd = 'python' })))
-- The above would print out a table like this, only if you have connected to your distant server
-- already via `DistantLaunch` or `DistantConnect`
--
-- {
-- "distant", "client", "shell",
-- "--unix-socket", "/path/to/nvim-8996.sock",
-- "--windows-pipe", "nvim-5671",
-- "--connection", "2377319893",
-- "--", "python"
-- }
Thanks I'll give it a try whenever I can. Much appreciated.
Going to close this out. You should be able to use #88 (wrap API) to do this more easily.
For your iron situation, I think something like this would work:
iron.setup {
config = {
-- Your repl definitions come here
repl_definition = {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = require("distant").wrap({ cmd = {"zsh"} })
}
},
}
}
Hey there, I am trying to figure out if I can use this great plugin with my workflow. Right now my remote machine has anaconda virtual environment and on my neovim I have vim-slime. So a good workflow would be:
Sorry to ask for so much 😃. If anyone has guidance I'm sure this would help other python users. Best,