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.