Saluton Yue :)

On Mon 1 Jun 2009 13:39, Wu +0200, Yue <[email protected]> dixit:
> On Mon, Jun 01, 2009 at 08:54:34AM +0200, Raúl Núñez de Arenas
> Coronado wrote:
>> In this case and in my humble opinion, you need a change in the way
>> you work to avoid having to modify files concurrently. It is
>> dangerous unless *everybody* uses the same tool for modifying the
>> files *and* that tool has been designed for such job (concurrent
>> editing). I've read the other messages you've written about the issue
>> and from my point of view the problem is that you shouldn't be doing
>> concurrent edition ;)) If you have to do it (we can't always choose
>> how to work, unfortunately), look for a tool designed to do
>> concurrent edition or sooner or later you will get a nasty surprise:
>> lost data. If you want me to I can explain what kind of data losing
>> you may suffer, but I'll do in a private email because that would be
>> offtopic :)
>
> Yes, after many kind of help and advice, I realize I'm trying to do
> something in a wrong way, it's dangerous.

It's dangerous only if you don't use the appropriate tools, and only if
more than one person can write the file at any given point in time.

> But what about in this case: I want to share a file with others and we
> can edit one same file, so it can act like that we are chatting via
> this file, and when I'm typing something, then others typing will show
> up dranamically, I think it's a case of concurrent editing, hmm?

I understand the example, but in that case I would use a chat program ;)
Anyway, I understand your point: if you need to do the concurrent
editing, you need it, period. In that case I think it is safer if you
use a tool that supports concurrent editing instead of tweaking Vim to
do the job (which may be possible).

> Someone advices me the netmeeting, I don't know if he says the
> Microsoft's apps, but maybe that's the right tool for doing such
> thing. I'm a vim fans, maybe I'm trying to do something that has
> extently exceeded vim's ability.

I think you could write some autocommands for CursorHold, CursorHoldI,
CursorMove and CursorMoveI so that if the file is changed you reload it,
but that way the changes you made are lost. Mixing your changes and the
changes from other people is possible by using "diff" or "diff3" when
reloading the file.

Under Linux you can use inotify to check if someone wrote to the file
and the reload it, but right now I don't know how to use that to force
the rest of Vim processes to reload and merge the file.

Please note that no matter if you use an inotify-based solution or some
autocommands to monitor the file and reload+merge it, this is very error
prone and problems will happen as soon as two writers make incompatible
changes (both of them modify the exact same line, for example).

Your problem has no easy solution using Vim, because the only way you
could use Vim for what you want to do is to have just ONE Vim instance
acting as "server", and that instance is the only with physical access
to the concurrently-edited file. After that, each person editing the
file just uses a "client" Vim that sends keystrokes to the server. The
server performs the actions from all clients and updates all of them
with the new file contents. This is not concurrent at all, because the
actions from the clients are serialized, but it is collaborative,
changes are shown automatically, etc. The only problem with this
solution is that, as far as I know, you can set up a Vim server editing
a file and accepting keystrokes from clients, but you cannot set up a
"client" Vim that sends all the keystrokes to the server and receives
the updated file contents. The only way I know of sending keystrokes to
a "server" Vim is to use "--remote-send".

-- 
Raúl "DervishD" Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to