I'd like to edit the same file at two different locations, let's say at the beginning and at the end of the file.

Splits (:sp) are a natural way to do this.

I have two monitors available and it sure would be convenient to have each split on a different monitor.

For example, is there a way to break out a split into its own window so I can move the window to the other monitor with my window manager (Sway)?

I'm looking for a solution that preferably doesn't rely on plugins, like vim-multiple-monitors.

I'm using Neovim 0.6.1.

1 Answer 1


You have an OS window and you have a vim window. A normal instance of vim can't live in 2 different OS windows. However, two clients attached to the same server can live in different OS windows.

Since you are using nvim, the syntax is different. You can start nvim as a server. It will listen on a socket you define: nvim --listen ~/.cache/nvim/server.pipe.

And then the other window just needs to open up a client to this server.

Start an Nvim server listening on a named pipe at '~/.cache/nvim/server.pipe': >
    nvim --listen ~/.cache/nvim/server.pipe

Edit "file.txt" in an Nvim server listening at '~/.cache/nvim/server.pipe': >
    nvim --server ~/.cache/nvim/server.pipe

Now you have 2 instances of vim that're editing the same file. This is not how you're supposed to use this, but... whatever. nvim will automatically load all changes written in one buffer to the other. You just have to say "Edit Anyway" when the "This file is already being edited" error message pops up.

I do NOT recommend doing this, but it worked for me, and who am I to judge :)... The screen won't be updated it gains focus, unlike vim-native windowed splits.

  • Thanks for the info. Using --servername is not possible in Neovim currently since it doesn't implement +clientserver. See also this. Jan 8, 2022 at 9:12
  • 1
    @Rich You're right, the command should have been --listen. I will edit my answer Oct 5, 2022 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.