Finding the recovered swap name

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Finding the recovered swap name

Gary Johnson-4
If I try to recover a file using the :recover command and there is
more than one swap file for that file, Vim presents a list of "Swap
files found" and asks me to "Enter number of swap file to use".
Vim then suggests that I "may want to delete the .swp file now."  To
do that, I have to write down or remember which swap file I chose so
that I can delete the right one when I've verified the recovered
file's contents.

Is there some way to have Vim tell me which swap file it used to
recover the current file?

Regards,
Gary

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Christian Brabandt

On Do, 07 Dez 2017, Gary Johnson wrote:

> If I try to recover a file using the :recover command and there is
> more than one swap file for that file, Vim presents a list of "Swap
> files found" and asks me to "Enter number of swap file to use".
> Vim then suggests that I "may want to delete the .swp file now."  To
> do that, I have to write down or remember which swap file I chose so
> that I can delete the right one when I've verified the recovered
> file's contents.
>
> Is there some way to have Vim tell me which swap file it used to
> recover the current file?

No and even worse, even if one does :au SwapExists :let
b:swapname=v:swapname it looks like it will always contain the first
swapfile found, not the one actually selected.

Christian
--
Wir leben in einem gefährlichen Zeitalter. Der Mensch beherrscht die
Natur, bevor er gelernt hat, sich selbst zu beherrschen.
                -- Albert Schweitzer

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Bram Moolenaar
In reply to this post by Gary Johnson-4

Gary Johnson wrote:

> If I try to recover a file using the :recover command and there is
> more than one swap file for that file, Vim presents a list of "Swap
> files found" and asks me to "Enter number of swap file to use".
> Vim then suggests that I "may want to delete the .swp file now."  To
> do that, I have to write down or remember which swap file I chose so
> that I can delete the right one when I've verified the recovered
> file's contents.
>
> Is there some way to have Vim tell me which swap file it used to
> recover the current file?

I usually edit the file again and at the "existing swap file prompt"
select "D" for delete.  If there are multiple I suppose only the one you
used is relevant and all others can be deleted as well?

--
From "know your smileys":
 :q vi user saying, "How do I get out of this damn emacs editor?"

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Bram Moolenaar
In reply to this post by Christian Brabandt

Christian Brabandt wrote:

> On Do, 07 Dez 2017, Gary Johnson wrote:
>
> > If I try to recover a file using the :recover command and there is
> > more than one swap file for that file, Vim presents a list of "Swap
> > files found" and asks me to "Enter number of swap file to use".
> > Vim then suggests that I "may want to delete the .swp file now."  To
> > do that, I have to write down or remember which swap file I chose so
> > that I can delete the right one when I've verified the recovered
> > file's contents.
> >
> > Is there some way to have Vim tell me which swap file it used to
> > recover the current file?
>
> No and even worse, even if one does :au SwapExists :let
> b:swapname=v:swapname it looks like it will always contain the first
> swapfile found, not the one actually selected.

I thought it mentioned "using swap file xxx".

We can mention the name again later.

Hmm, the hit-enter prompt is in the wrong place, let me fix that as
well.

--
Where do you want to crash today?

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Gary Johnson-4
In reply to this post by Bram Moolenaar
On 2017-12-09, Bram Moolenaar wrote:

> Gary Johnson wrote:
>
> > If I try to recover a file using the :recover command and there is
> > more than one swap file for that file, Vim presents a list of "Swap
> > files found" and asks me to "Enter number of swap file to use".
> > Vim then suggests that I "may want to delete the .swp file now."  To
> > do that, I have to write down or remember which swap file I chose so
> > that I can delete the right one when I've verified the recovered
> > file's contents.
> >
> > Is there some way to have Vim tell me which swap file it used to
> > recover the current file?
>
> I usually edit the file again and at the "existing swap file prompt"
> select "D" for delete.  If there are multiple I suppose only the one you
> used is relevant and all others can be deleted as well?

I my case, I often open a couple of vim or gvim instances and use
them for taking notes, without saving any of the buffers to files.
When I'm done with each of them, I just quit Vim and I don't have to
clean up any files.  However, every now and then, the machine I'm
using goes down or is taken down without warning, and I need to
recover the buffers I had open.  So I start vim or gvim, execute
:recover and am presented with a list of swap files found with names
like

    %home%gary.swn
    %home%gary.swo
    %home%gary.swp

I open each one and see if I need to keep the contents.  Then,
whether or not I want to keep one, I have to delete its swap file.
But which one?  Yes, I could just pay close attention and remember
which swap file I opened in which window, and remember the swap
directory used on that particular machine, but it would be so nice
to be able to write a command like :DeleteSwap and have it just know
the swap directory (that I can do) and the swap file name and just
do it without me having to think.

Regards,
Gary

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Bram Moolenaar

Gary Johnson wrote:

> On 2017-12-09, Bram Moolenaar wrote:
> > Gary Johnson wrote:
> >
> > > If I try to recover a file using the :recover command and there is
> > > more than one swap file for that file, Vim presents a list of "Swap
> > > files found" and asks me to "Enter number of swap file to use".
> > > Vim then suggests that I "may want to delete the .swp file now."  To
> > > do that, I have to write down or remember which swap file I chose so
> > > that I can delete the right one when I've verified the recovered
> > > file's contents.
> > >
> > > Is there some way to have Vim tell me which swap file it used to
> > > recover the current file?
> >
> > I usually edit the file again and at the "existing swap file prompt"
> > select "D" for delete.  If there are multiple I suppose only the one you
> > used is relevant and all others can be deleted as well?
>
> I my case, I often open a couple of vim or gvim instances and use
> them for taking notes, without saving any of the buffers to files.
> When I'm done with each of them, I just quit Vim and I don't have to
> clean up any files.  However, every now and then, the machine I'm
> using goes down or is taken down without warning, and I need to
> recover the buffers I had open.  So I start vim or gvim, execute
> :recover and am presented with a list of swap files found with names
> like
>
>     %home%gary.swn
>     %home%gary.swo
>     %home%gary.swp
>
> I open each one and see if I need to keep the contents.  Then,
> whether or not I want to keep one, I have to delete its swap file.
> But which one?  Yes, I could just pay close attention and remember
> which swap file I opened in which window, and remember the swap
> directory used on that particular machine, but it would be so nice
> to be able to write a command like :DeleteSwap and have it just know
> the swap directory (that I can do) and the swap file name and just
> do it without me having to think.

Perhaps we can put the name in b:recovered_swapfile, then you can define
a command to use that.

--
From "know your smileys":
 (X0||)   Double hamburger with lettuce and tomato

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
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.
Reply | Threaded
Open this post in threaded view
|

Re: Finding the recovered swap name

Gary Johnson-4
On 2017-12-10, Bram Moolenaar wrote:

> Gary Johnson wrote:
>
> > On 2017-12-09, Bram Moolenaar wrote:
> > > Gary Johnson wrote:
> > >
> > > > If I try to recover a file using the :recover command and there is
> > > > more than one swap file for that file, Vim presents a list of "Swap
> > > > files found" and asks me to "Enter number of swap file to use".
> > > > Vim then suggests that I "may want to delete the .swp file now."  To
> > > > do that, I have to write down or remember which swap file I chose so
> > > > that I can delete the right one when I've verified the recovered
> > > > file's contents.
> > > >
> > > > Is there some way to have Vim tell me which swap file it used to
> > > > recover the current file?
> > >
> > > I usually edit the file again and at the "existing swap file prompt"
> > > select "D" for delete.  If there are multiple I suppose only the one you
> > > used is relevant and all others can be deleted as well?
> >
> > I my case, I often open a couple of vim or gvim instances and use
> > them for taking notes, without saving any of the buffers to files.
> > When I'm done with each of them, I just quit Vim and I don't have to
> > clean up any files.  However, every now and then, the machine I'm
> > using goes down or is taken down without warning, and I need to
> > recover the buffers I had open.  So I start vim or gvim, execute
> > :recover and am presented with a list of swap files found with names
> > like
> >
> >     %home%gary.swn
> >     %home%gary.swo
> >     %home%gary.swp
> >
> > I open each one and see if I need to keep the contents.  Then,
> > whether or not I want to keep one, I have to delete its swap file.
> > But which one?  Yes, I could just pay close attention and remember
> > which swap file I opened in which window, and remember the swap
> > directory used on that particular machine, but it would be so nice
> > to be able to write a command like :DeleteSwap and have it just know
> > the swap directory (that I can do) and the swap file name and just
> > do it without me having to think.
>
> Perhaps we can put the name in b:recovered_swapfile, then you can define
> a command to use that.

If you could, that would be great.

Regards,
Gary

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