Status of "multihead"? (multiple independent UIs attached to a single Neovim instance)

I would like to have multiple UIs (in separate OS windows, on separate physical displays) with different “views” onto the same Neovim instance. Each UI would operate on the same set of buffers, but with an independent tab/window (i.e. pane/split) layout. My primary interest in this is running a debugger UI in a separate OS window from my main editing window.

I am aware that you can have two UIs connected to the same instance that mirror one another, but I am specifically looking for the ability to vary the UIs independently. I have done a fair amount of docs/github/reddit spelunking and am confused as to the status of this feature, which as best I can make out is called “multihead”. The most recent relevant discussion I can find is: Multihead · Issue #19502 · neovim/neovim · GitHub

In this issue, OP asks for the feature:

Allow multiple terminals to connect to a single nvim process, each acting as a “window”. This is primarily so that I can use my OS window system instead of neovim’s builtin one.

@justinmk says this is:

Already possible by using any GUI client… [This functionality] is up to the client. We likely won’t support that with the TUI client initially, but maybe in the future.

I tried starting an nvim session with the TUI and then connecting with Neovide:

### terminal 1
$ NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim

### terminal 2
$ neovide --server /tmp/nvimsocket

I found that the UIs were mirrored, and could not find a way to vary them. Then there are an (old) open issue and PR that are linked by another poster in the above-referenced issue. These suggest that independent UIs are not currently supported.

So my questions are:

  • Is the functionality I describe possible with nvim nightly as of 2023/12/22?
  • If not, is it likely to be supported anytime soon?
1 Like

“Multihead” is an open issue, see Multihead · Issue #19502 · neovim/neovim · GitHub

p.s. I strongly recommend using neovim/neovim · Discussions · GitHub instead of discourse.

Here’s how I do multi-session editing on ubuntu 22.04 in the terminal (nvim 0.9.4):

  • terminal1> nvim --listen ~/.neovim
  • terminal2> nvim --server ~/.neovim --remote

With this setup, you can copy and paste across sessions.

There needs to be special support in the UI for this - the UI has a choice between drawing everything in a single OS window or to create multiple OS windows for each Neovim window, and for now every usable UI seems to prefer using a single OS window. In my experience (Implement persistent server by glacambre · Pull Request #382 · glacambre/firenvim · GitHub and GitHub - glacambre/nwin: N vim win! Neovim UI designed for Sway/i3. ), multi-os-window UIs are significantly harder to get right than the “every neovim window in a single OS window” method, but not impossible to achieve.

1 Like