Monday, October 18, 2021

Re: Vim backup files

There are options to change the location and to disable backup files for certain filetypes.  My .vimrc file has:

      autocmd BufNewFile,BufRead /tmp/crontab* set nobackup nowritebackup

      set backupdir=~/Library/Caches/vim/backup//

      set backup


On Monday, October 18, 2021 at 5:31:34 AM UTC-4 Bram Moolenaar wrote:

Steve Litt wrote:

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

The backup file of file.txt is .file.txt~.
The .swp file is a binary format, although it does contain the text in
some way.

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

You can use "vim -r" to list swap files. If you see the one you need
then use "vim -r .file.txt.swp" to recover it.

--
hundred-and-one symptoms of being an internet addict:
184. You no longer ask prospective dates what their sign is, instead
your line is "Hi, what's your URL?"

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6d042fdf-91fa-4a0f-9e5e-5748c49f6fban%40googlegroups.com.

No comments:

Post a Comment