tags:

views:

130

answers:

3

I have three monitors.

I normally run one maximized xterm on each monitor, attached to the same GNU screen session.

Can a similar model be used for vim? Is it possible to have three vims running, all sharing the same "vim session":

  • Each vim window showing a different vim tab
  • vim settings shared between all windows
  • Not getting the "Swap file ... already exists!" error message if I open the same file on two tabs.
+2  A: 

No, a Vim instance is limited to a single application window on your desktop. The different Vim instances have independent sessions.

In addition, be aware that if you open the same file in two different Vim instances, not only do you get the 'Swap file exists' message, but the two instances do not share a buffer, so changes made in one are independent of the other.

If a changed file is saved in one instance you will get a message when you return to the file in another Vim instance that 'the file has changed since editing started' and asking you if you want to reload the file (which would load changes as saved by the other instance, disregarding any changes you had made in the current instance).

Herbert Sitz
+1  A: 

I have a working solution where two vim instances communicate.

http://github.com/codeape2/vim-multiple-monitors

It uses the SwapExists autocmd to instruct the other instance to open a file if an existing swap file is detected.

codeape
A: 

You can use vim under screen.

$ screen
$ vim

# on another terminal 
$ screen -x
# the same vim screen

If your terminal emulator supports tabbing (e.g. gnome-terminal), you can use it as a tabbing (IMHO, gnome-terminals' tabbing support is better than vim's own, except perhaps you can't copy and paste among different vim sessions, however you can instead use the system copy-paste buffer: "+y and "+p).

This does not work if you're using gvim though.

Lie Ryan