16

With vim, can two users edit the same file at the same time?

Troggy
  • 10,259
juanpablo
  • 7,424

8 Answers8

9

Sorry no such feature, found this advice:

The common suggestion is to use a shared "GNU Screen" session:

http://groups.google.com/group/vim_use/browse_thread/thread/f502e7783038d484/c4603374d2e752b2

to do collaborative editing in Vim. However, it's a bit tricky because it's modal, so if one person changes modes, the other person has to adapt accordingly.

Nifle
  • 34,998
7

Sorry to dig out this old question but as I bumped on it and found an answer here it is:

Have a try with https://github.com/FredKSchott/CoVim

EDIT: this project is now archived on Github, last change was made on 2017

Yannick
  • 121
3

I'm not aware of any vim plugins for collaborative editing, but have a look at gobby.

vtest
  • 5,358
2

There's a Multiplayer vim plugin leveraging ssh and swap files to do the job. Users have individual settings, registers and stuff while allowing them to look into each others' editing contexts.

Also Floobits has a plugin for neovim.

L29Ah
  • 238
  • 2
  • 10
2

I don't think so, because Vim creates a swap file any time you open a file. This swap file helps if you want to recover after some sort of an error. When the second user opens the file, his or her Vim will see the swap file and get an error and the options to ignore, delete, recover, etc. I don't think that both users would be able to simultaneously edit this file.

I think the best way to have both users work on the same file is to use a version control system. I like mercurial (good tutorial here), but subversion and git are the classics.

2

i know it's dirty too but you may use screen for the first terminal then screen -x on the second one and so on when logged into a terminal with the same user from somewhere else

2

vim-multiuser looks interesting. It actually allows users to be in different modes at the same time.

dfedde
  • 121
0

Somebody has mentioned something similar on Hackernews. You might want to check it out:

http://news.ycombinator.com/item?id=720764

You might also want to take a look at DocSynch (its peresently available only for JEd, a VIM plugin is supposedly still in development). One dirty hack would be to sync your files over a file storage service like Dropbox.