Monday, March 13, 2017

Why doesn't Vim auto cleanup old junk files (.swp holding no changes and are not a lock)

Tony Mechelynck wrote:
> On Sun, Mar 12, 2017 at 1:41 AM, L A Walsh <vim@tlinx.org> wrote:
>
>> I have near a dozen files where I have both a ".cc and a .h"
>> open but had a desktop reboot, so all have swap files now.
>> Just now, I opened them all and found that only 1
>> pair had any changes that needed to be addressed, but the
>> others were all 'unmodified'.
>>
>>
>> Is there a way to have vim automatically delete the swap
>> files for which there are no changes and no running process?
>>
>> Alternative, is there a way to tell in a shell that
>> some correspond to unmodified files so I could pre-delete
>> them in restarting gvim for all the files?
>>
>> I don't want to blindly try to recover them, as any that
>> do have actual changes, I want to know about so I
>> can write them to /tmp and compare them w/the origs to
>> see if what the changes are and if they should be kept
>> (usually should, but occasionally not).
>>
>> Thanks in advance!
>> -linda
>>
>
> You could try creating an autocomand for the |SwapExists| event. Set
> |v:swapchoice| to one of the values mentioned in the help for that
> event, or to the empty string to ask the user.
>
----
Thanks Tony, but that doesn't sound very "automatic"... ;-/.
On top of that, say I create an autocmd, how do I tell which
value to choose? I only would want to have them removed if
they were unmodified AND if they were not currently being
edited by an active process.

Maybe a different question: Why doesn't vim clean up
junk left over from a crash -- i.e. swp files that don't hold
any changes and that are not locks from another, active process?
I find such messages "confusing" and slowing down my work, since
I have to bother looking at each of 10-20 messages and making
some decision.

Is there a reason why vim doesn't clean up its unnecessary
"junk" files that, _clearly_ hold no useful information (i.e.
no changes, and are not locks for active processes)?

Why wouldn't that be regarded as a bug?


Thanks!
Linda

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment