Attach --remote-ui when already inside a NeoVim instance

Hi guys,
as the title I would like to know if there is a way to attach to a nvim --listen instance when I’m already inside a NeoVim instance.

In particular, I would like to improve this plugin GitHub - esensar/nvim-dev-container: Neovim dev container support - Mirror of https://codeberg.org/esensar/nvim-dev-container.

Atm this plugin installs NeoVim inside the container, and runs it interactively in a NeoVim terminal.

What I would like to achieve is to have NeoVim’s instance inside the container to run as the server, so that I can attach to it from the host NeoVim (the one which builds and runs the container with the nested NeoVim).

Any idea about how this could be achieved?

Here the issue mentioning this.

The flow should be similar with what nvr already does, but the difference is that:

  • host NeoVim runs first, builds and runs the container with server NeoVim (nvim --listen <PORT>)
  • host NeoVim should be able to attach to the server NeoVim’s UI