On 18/04/09 13:57, Michael Henry wrote:
>
> All,
>
> A recent thread[1] has prompted me to ask how to share an existing
> Vim instance from multiple machines.
>
> At work, we have two lab areas. Each developer has a Linux box in the
> main lab on which to do work, and he generally used Gvim under the X
> window system for this purpose. When in the other lab, he often wants
> to view or edit the files on his main Linux box. This is generally done
> by an ssh connection into the main Linux box followed by starting up
> another instance of Vim. The "Swap file exists" message is a common
> occurrence for us, and it generally does not indicate a crashed ssh or
> vim session. We do not generally leave unsaved changes in running Vim
> sessions, and we have Vim configured to re-read changed files
> automatically (via :set autoread). I'm not really comfortable with this
> mode of operation, though, because I don't like conditioning our
> developers to ignore the swapfile message. We could use GNU screen and
> console Vim to resume a single session of Vim remotely, but that loses
> the nice Gvim features. I've seen suggestions to use VNC even when
> using a box locally so that the entire graphical session can be resumed
> from a remote connection, but that loses the local feel (not all
> keystrokes are transparently fed through VNC, and it doesn't feel
> snappy).
>
> Does anyone have a preferred solution for sharing running Vim instances
> from multiple machines?
>
> Thanks,
> Michael Henry
>
> [1]: vim_dev's thread 'Feature request: Add a Diff option upon open when
> "Found a swap file..."'
AFAIK, the closest thing to what you want is the |clientserver|
functionality. However I don't know if it's adequate or even if it can
be made so, and in any case it's nothing like accessing a single Vim
from several workstations at the same time; you might have to write some
ad-hoc scripts to get what you want.
OTOH you might just make sure that any edit file is edited (in
'noreadonly' mode) on only one machine at a time, and then closed.
(":view filename" doesn't create a swapfile but IIUC ":setl readonly"
doesn't close an existing one.) Vim was conceived as a single-threaded
program, and it doesn't really include safeguards against editing the
same file at cross-purposes from two workstations.
To use the clientserver functionalty, the following are required:
- The server and client must both be compiled with +clientserver
- They must have access to some way to pass messages to each other (such
as a common X server)
- The server must be started as a server. This is the default on gvim
(except when running as root) but not on Console Vim; in other cases you
need a --servername command-line argument.
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
10. And even your night dreams are in HTML.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---