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 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
On Sun, Mar 12, 2017 at 1:41 AM, L A Walsh <[hidden email]> 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Tony Mechelynck wrote:
> On Sun, Mar 12, 2017 at 1:41 AM, L A Walsh <[hidden email]> 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by L. A. Walsh
You could try https://github.com/chrisbra/Recover.vim
-- -- 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Paul wrote:
> You could try https://github.com/chrisbra/Recover.vim --- Thanks Paul, it looks like it might be "morphable" into what I want. It currently has a bug where it defaults the action to "Delete" when there are no diffs -- **whether or not** the file is already open in another window (and just not changed). If that can be 'fixed', then either could have an option for it to 'auto-choose' delete, or I can patch that code... But it needs to differentiate between "no-edits"+crash vs. "no-edits"+currently being edited" FWIW -- it's a bit "overkill" for what I wanted, as it also provides option to 'diff', automatically if the swap-version & disk version are different. I don't know if it is needed, but it seems to use python -- maybe only the diff needs that? The diff is handy, as I usually do a diff anyway if I find changes, BUT not detecting file already being edited limits its usefulness. (Submitted bug & rfe on github site -- hopefully author is still around and gets notices... ) Thanks again! -- -- 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hi L!
On Di, 14 Mär 2017, L A Walsh wrote: > Paul wrote: > >You could try https://github.com/chrisbra/Recover.vim > --- > Thanks Paul, it looks like it might be "morphable" into what > I want. It currently has a bug where it defaults the action > to "Delete" when there are no diffs -- **whether or not** > the file is already open in another window (and just > not changed). I am fairly certain it doesn't. > FWIW -- it's a bit "overkill" for what I wanted, as > it also provides option to 'diff', automatically if the > swap-version & disk version are different. I don't know > if it is needed, but it seems to use python -- maybe Not it doesn't > only the diff needs that? The diff is handy, as > I usually do a diff anyway if I find changes, BUT > not detecting file already being edited limits its > usefulness. > > (Submitted bug & rfe on github site -- hopefully author > is still around and gets notices... ) Author here. Best, Christian -- Wer ihn als einen Gott der Liebe preist, denkt nicht hoch genug von der Liebe selber. Wollte dieser Gott nicht auch Richter sein? Aber der Liebende liebt jenseits von Lohn und Vergeltung. -- Friedrich Wilhelm Nietzsche (Zarathrustra IV) -- -- 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 [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |