codeape
codeape

Reputation: 100766

Working with vim on multiple monitors

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":

Upvotes: 28

Views: 11654

Answers (5)

samYemmY
samYemmY

Reputation: 13

:set noswapfile :set autoread

Buffers aren't shared this way but vim reads file changes automatically if you save it. And you don't get that 'Swap file exists' message.

Upvotes: 1

user3034472
user3034472

Reputation:

Neovim is a project that aim to give vim attach/detach feature like tmux. This feature isn't yet implemented (june 19th 2015), but this may come soon.

There is many other core features for this project that you can see at neovim.io.

Upvotes: 2

Lie Ryan
Lie Ryan

Reputation: 64837

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.

Upvotes: 4

codeape
codeape

Reputation: 100766

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.

Upvotes: 16

Herbert Sitz
Herbert Sitz

Reputation: 22226

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).

Upvotes: 3

Related Questions