On Sat, May 30, 2009 at 08:22:58PM -0500, Tim Chase wrote:
>
> > For example, if I'm editing a file, and the file has been
> > modified by external tool, say echo foo >> file, since the
> > last time I haved saved, then now after I'm finishing the
> > editings and want to write the file to disk, then vim will
> > warn that file has been changed, what should I do? 1) Abandon
> > my editing; 2) Abandon the changes by external tool. Both of
> > them are not so good.
>
> If something has changed the file that I'm currently editing
> (such as a parallel edit session or a automated script), I'll
> often yank my buffer into a new one:
>
> :%y
> :new
> :0put
> :$d
>
> then switch back to my original buffer and reload it:
>
> :e!
>
> and compare the two buffers:
>
> :windo diffthis
>
> (assuming only two windows are open...otherwise, visit each one
> and ":diffthis" on it.)
>
> This allows me to get/put differences in the files. If it was
> something that happened frequently, I'd likely create a few
> mappings to facilitate it. Or perhaps the "DiffOrig" command
> (":help DiffOrig") instead.
But when you're diffing them, buffer may has changed from external again, so
the diff can be messed up. I realize it's complicated to achieve it, it has to
make vim edit the file in disk, not in mem's one, so the dynamic change can be
seen on the fly.
The example I gave is not quit good, it can be soloved by vcs. Sorry, I give a
more proper example here: if I'm editing one file with other guy, and want to
let him adds some lines in the file, and let me revise it, then the co-editing
is much more convenient. I heard of that M$ office supports co-edit, don't
know how it supports that.
--
Hi,
Wu, Yue
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---