Sunday, October 17, 2021

Re: Vim backup files

Hi Steve!

On Sun, 17 Oct 2021 18:18:46 -0400
Steve Litt <slitt@troubleshooters.com> wrote:

> Hi all,
>
> I've used Vim since the 20th century, and of course things keep getting
> better, which means change. As I remember, back in the day, the Vim
> backup files that began with a dot and ended with .swp were text files
> containing what was in the window, and were automatically updated every
> X number of seconds. This appears to no longer be the case.
> .test.pl.swp appeared to be a binary file, so I couldn't just diff it
> with the original.
>
> In the past, after a crash, when I ran Vim on the file again, it gave
> me a dialog box in which to choose to recover, ignore, quit, whatever.
> This didn't happen in today's crash.
>
> I tried using :rec in the main file, it said there was no recovery
> file, and maybe changed the recovery file to .test.pl.swp.swp. I tried
> a few other things, but I was always just one step behind and
> eventually lost the swap files completely. Only one of them was
> important, and I have a paper copy, so I should be OK.
>
> After a crash, I'd like a way to know whether a swap file exists, and
> whether it indicates any differences from what's in my buffer. Is there
> a program that can do this for me, now that the dialog box doesn't
> happen anymore?
>

I tried it now:

```
[shlomif@telaviv1 ~]$ -t dotfiles
shlomif[dotfiles]:$trunk$ git i
⇒ On branch master
⇒ Your branch is up to date with 'origin/master'.
⇒ Remotes:
origin git@github.com:shlomif/shlomif-computer-settings.git (fetch)
origin git@github.com:shlomif/shlomif-computer-settings.git (push)
shlomif[dotfiles]:$trunk$ ls
LICENSE README.asciidoc README.asciidoc~ shlomif-settings
shlomif[dotfiles]:$trunk$ gvim README.asciidoc
shlomif[dotfiles]:$trunk$ pkill gvim
Vim: Caught deadly signal TERM
Vim: preserving files...
shlomif[dotfiles]:$trunk$ Vim: Finished.

shlomif[dotfiles]:$trunk$ git i
⇒ On branch master
⇒ Your branch is up to date with 'origin/master'.
⇒ Remotes:
origin git@github.com:shlomif/shlomif-computer-settings.git (fetch)
origin git@github.com:shlomif/shlomif-computer-settings.git (push)
shlomif[dotfiles]:$trunk$ la
total 68K
drwxr-xr-x 8 shlomif shlomif 4.0K Oct 18 08:15 .git
-rw-r--r-- 1 shlomif shlomif 4.8K Apr 21 08:23 .gitignore
-rw-r--r-- 1 shlomif shlomif 4.7K Jul 27 2020 .gitignore~
-rw-r--r-- 1 shlomif shlomif 2.3K Oct 6 2018 .hgignore
-rw-r--r-- 1 shlomif shlomif 9 Oct 6 2018 LICENSE
-rw-r--r-- 1 shlomif shlomif 17 Oct 6 2018 .perltidyrc
-rw-r--r-- 1 shlomif shlomif 866 Jul 21 19:28 README.asciidoc
-rw-r--r-- 1 shlomif shlomif 866 Jul 21 19:27 README.asciidoc~
-rw-r--r-- 1 shlomif shlomif 12K Oct 18 08:14 .README.asciidoc.swp
drwxr-xr-x 41 shlomif shlomif 4.0K Oct 2 2020 shlomif-settings
drwxr-xr-x 4 shlomif shlomif 4.0K Sep 8 2020 .tidyall.d
-rw-r--r-- 1 shlomif shlomif 523 Sep 29 2020 .tidyallrc
-rw-r--r-- 1 shlomif shlomif 2.2K Jul 17 2020 .travis.yml
shlomif[dotfiles]:$trunk$

```

After I edited README.asciidoc again, I got this dialog:
https://www.shlomifish.org/Files/files/images/gvim-recover-Screenshot_2021-10-18_08-16-50.png
. Pressing "Recover" restored my unsaved changes.

So "works for me" with my vim config (
https://github.com/shlomif/shlomif-computer-settings/tree/master/shlomif-settings/vim-conf
).



> Thanks,
>
> SteveT
>
> Steve Litt
> Spring 2021 featured book: Troubleshooting Techniques of the Successful
> Technologist http://www.troubleshooters.com/techniques
>



--

Shlomi Fish https://www.shlomifish.org/
https://youtu.be/GoEn1YfYTBM - Tiffany Alvord - "Fall Together"

If Chuck Norris is disappointed by you not following his advice, he'll survive.
On the other hand, you will not.
https://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - https://shlom.in/reply .

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20211018082916.66e2d76d%40shlomifish.org.

No comments: