remote-nvim.nvim icon indicating copy to clipboard operation
remote-nvim.nvim copied to clipboard

Explain the difference between the plugin and the usual ssh + nvim

Open 00sapo opened this issue 1 year ago • 2 comments

Reading the readme and trying the plugin, it looks to me it's doing something very similar to ssh into the remote server and then running nvim as usual.

Can you expand on the benefits of this plugin? Maybe in the readme?

Thanks! f

00sapo avatar Apr 28 '24 08:04 00sapo

Thanks for raising this question. The overall goal is to take away the effort required to set things up as much as possible and provide Neovim equivalent of VS Code Remote Development.

It's the same as SSH+Neovim except this takes away most of the work needed to setting things up and provides some additional nice-to have features on top:

  1. Automatically installs Neovim on remote
  2. Does not mess with the global configuration and instead just writes everything to a single directory on remote
  3. Can copy over your local Neovim configuration to remote
  4. Allows easy re-connection to past sessions
  5. Makes it easy to clean up remote machine changes once you are done

One other small difference is that it launches Neovim server on the remote server and connects a UI to it locally. This does not amount to much right now, but I plan to work on https://github.com/neovim/neovim/issues/24690 once I finish some of the missing features on this plugin. That should make the overall process equivalent to what remote SSH offers in VS Code.

Although, the plugin currently supports only SSH, as you can see in the README, plan is to support Docker, Devcontainer and k8s pods through the same interface.

Honestly, I would love more feedback on what people expect out of such a plugin and if you have any suggestions, do let me know.

amitds1997 avatar Apr 28 '24 14:04 amitds1997

Hi, thank you very much. Your plugin looks very promising. Honestly, I think the most important thing is to reduce the overhead connected with ssh in order to improve the performance on low quality connections. I guess that's something deeply connected with (and limited by) the nvim's client-server implementation. As of now, it doesn't look to be easy to send commands to a remote nvim instance that has a different configuration and that doesn't control the UI. If it would be possible, we could have a remote instance with the default configuration which modifies remotes files without having the plugins, lsp, etc installed. That's how vscode works...

00sapo avatar Apr 28 '24 18:04 00sapo

First of all sorry for hijacking this issue but I have a few open questions which are at-least loosely related.

I have looked at another plugin which seems to do a similar thing as this one. One of the main issues with it, is the current inability of neovim, to attach an already running neovim instance to a server with --remote-ui. This leads, at-least in the plugin mentioned, to the workaround of opening a nested neovim instance. Here is the issue I opened in the neovim repo for the above, it also references the relevant issue in the mentioned plugin repo.

My question now is does this plugin suffer the same fate? Or am I fundamentally misunderstanding something?

kedom1337 avatar May 27 '24 18:05 kedom1337

My question now is does this plugin suffer the same fate? Or am I fundamentally misunderstanding something?

Since it's a Neovim limitation, there is sadly no getting around (as of now).

From how I understand it, none of the IDEs try to replace their existing windows, they infact, either launch a separate tab or window with the launched instance (or at least that's how I have observed it).

This is possible fairly easily by something like this. By specifying the callback, your new UI client can be launched as a separate tab in your terminal, a separate terminal window or if you like, as an instance of your GUI Neovim instance. This is actually how I use it quite regularly.

It's possible to detach the original Neovim instance from the launched Neovim instance but I haven't completely plugged it in since I could not find a good UX for offering that as a choice to the user. It should also be possible to close the original Neovim server post that if necessary, but that would be a bit cumbersome.

I might have not fully understood your use case so let me know just in case.

amitds1997 avatar May 27 '24 19:05 amitds1997

Makes sense. Opening it in a different terminal tab seems to be a nice solution, certainly much nicer than opening neovim within a neovim terminal, until neovim hopefully adds functionality for attaching a running instance. I also just wanted to say thanks for your plugin, people like you are what make neovim awesome.

kedom1337 avatar May 28 '24 15:05 kedom1337