Saturday, March 11, 2017

Re: How to delete hidden .swap files (.sw?) if there are no changes?

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.

Best regards,
Tony.

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