> On 2012-04-09, AK wrote:
>> I just want to comment that I find the 'swap file already exists'
>> thingy to be very un-userfriendly. I think it would be immensely more
>> useful if it first showed a text-only diff of the file and swap file,
>> and then only gave the choices.
>
> I don't think diffing the two automatically by default would be a
> good idea. It can take a long time to diff large files.
It would be good to have this option in .vimrc, as most people never
edit files so large that diff would take noticeable time.
>
>> 2. Once I choose to open the file, why is there no built-in way to
>> compare them, and to delete the swap file?
>
> Diffing the two is pretty easy. Just use whatever method you
> usually use for comparing your editing buffer with the on-disk
> version, e.g.:
But I don't have any method for that, because I never need to,
and never do compare editing buffer with on-disk version.
In addition, the swap file may be in a completely different directory
compared to CWD -- for a new user especially, there's a lot of legwork
involved in something that could be handled automatically.
I've occasionally lost my work because of this whole mess.
Usually if vim crashes, I might have 15-20 buffers opened, and for most
of them I need to delete swap file right away because there were no
modifications, and I got used to that and occasionally lost a bit of
not-very-important changes.
At other times I would leave swap files lying around, planning to diff
them at a later time, and then accidentally restore an older swap file.
Again, never lost anything that'd take more than a few minutes to
restore, when I'm dealing with important pieces of code, I'm of course
much more careful, but it's still quite annoying when it happens.
In fact it hasn't happened in the last year or so because I've now
disciplined myself into diffing with the swap file immediately and have
a mapping or a function to delete associated swap file.
>
> 1. :DiffOrig
> 2. :w !diff "%" -
I have DiffOrig command but it's not builtin, and I bet most new users
don't have it, and I don't think it's a good command for this scenario
because, if you opened the file, and want to diff it with swap file, it
would not help; and loading from swapfile is something that I feel is
dangerous to do because you're just a write command away from losing the
original file, and I have a write command mapped to an easy key that I
use very often, so I can see myself looking through the file for
changes, being distracted by an email, and then writing it to disk
accidentally.
Unless I misunderstand how this whole thing is supposed to work.
It all seems a lot more complicated than it needs to be. Most commonly,
a user needs to find out if files are different, and if so, what are the
differences, and then he needs an easy menu to make the choice. Right
now vim does it backwards.
-ak
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment