0

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.

0

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.

So... start vim as a server: :help --servername. And then open 2 OS windows up, and attach them to this server as a client. Maybe this will work for you. You'll need to do some reading. When you figure it out, please answer this question with what you did!


Additional info...

A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can
also act as a command server if a server name is explicitly given with the
--servername argument, or when Vim was built with the |+autoservername|
feature.

I skimmed https://ajayfromiiit.wordpress.com/2009/10/21/server-and-client-mode-in-vim/ but did not test it out myself as it was a lot of text...

1
  • Thanks for the info. Using --servername is not possible in Neovim currently since it doesn't implement +clientserver. See also this. Jan 8 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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