28

Is it possible to have 2 or more (G)vim windows for the same session, or at least share some buffers. Here, "window" refers to a Gnome(or KDE, or Windows etc.) window, not a VIM window.

I use two monitors with xinerama and want to open two separate GUI windows instead of having a huge single one that spans multiple screens.

Atilla Filiz
  • 1,226

6 Answers6

19

Currently gVim cannot have separate 'toplevel' windows for the same process/session. There is a TODO item to implement an inter-process communication system between multiple Vim instances to make it behave as though the separate processes are unified. (See :help todo and search for "top-level".)

Heptite
  • 20,411
3

Take a look at GNU screen used in conjunction with Vim.

First window, start up gnu screen and vim

xterm
screen -S edit
vim

Second window, connect to screen session:

xterm
screen -x edit

Incredibly useful over large xinerama desktops, multiple virtual screens, or VNC sessions. One session of Vim, with lots of tabs, is all you need.

-- Tom

Tom
  • 31
3

It's been some time since you asked your question and many things have improved. Nvidia has much better driver support for multiple monitors on Linux.
I've now stopped using Gvim since I moved over to KDE: Now I'm using vim-qt. It allows you to open multiple instances, in case you don't want to use vim in the terminal.

edit: My setup

2

I have been looking for a solution to this problem for quite a while now and just found out (pretty much by accident) that there is a GUI wrapper for Neovim, which has support for independent windows for the same instance!

https://github.com/yatli/fvim

You can detach a window into an external OS window with Ctrl+w g e.

Unfortunately I have discovered that it doesn't really play well with some plugins, so I don't use it at the moment. It might be worth keeping an eye on the following list to see if any of the other GUI wrappers implement a similar feature: https://github.com/topics/neovim-guis


Edit: I have just found some more approaches towards a solution to the same problem:

Isti115
  • 1,242
1

You can have as many vi(m) sessions as you want by using separate terminal windows for each.

As for not having them span across, I assume you are putting them to full screen and then it is expanding across both monitors as it is set to an extend the desktop. Don't maximize it and manually adjust the terminal or gvim window size.

If I missed the mark please try to elaborate a little more.

What do you mean by vim window?

edit: Here's a pic of my screen with 4 vim instances running

Hopefully Heptite hit it, because I was kind of lost with this one.

0

I have no problem starting multiple gvim version 9 session from a non-root user command prompt:

$ gvim &

The problem seems to be isolated to starting gvim from gnome desktop only.