Monday, March 9, 2026

Re: Backup Directory

On Mo, 09 Mär 2026, CrestChristopher wrote:

> When I create a file in Vim, save it; a backup should be created after the
> save or after I've saved and added more to the document. In either case none
> of these two are working ?

So I tried this out:

#v+
~/tmp/$ mkdir ~/vim-backup
~/tmp/$ cat backup.vim
set nocp
set backupdir=~/vim-backup//
set backup
~/tmp/$ vim --clean -u backup.vim
:e ~/.vim/vimrc
:w
:q
~/tmp/$ ls -l ~/vim-backup/
-rw-r--r-- 1 chrisbra chrisbra 12481 Jan 20 2025 %home%chrisbra%.vim%vimrc~
#v-

Works as expected.


Thanks,
Christian
--
Death is God's way of telling you not to be such a wise guy.

--
--
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 visit https://groups.google.com/d/msgid/vim_use/aa7R3tRl7Zr/fA%2BT%40256bit.org.

Re: Backup Directory

On 3/9/2026 8:22 AM, Christian Brabandt wrote:

> On Mo, 09 Mär 2026, CrestChristopher wrote:
>
>> Although I typed out the full home path where the .backup directory is
>> located query the path returned; backupdir=~/.backup//
>>
>> In this case, after typing something in vim, and quitting without
>> saving; there was no backup saved in the backupdir path ?
> I believe backup is only ever done when saving a file, not from
> arbitrary points in time. There are however plugins available that do
> this. Perhaps you should start explain, what exactly you are trying to
> achieve?
>
> Thanks,
> Christian

When I create a file in Vim, save it; a backup should be created after
the save or after I've saved and added more to the document. In either
case none of these two are working ?

--
--
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 visit https://groups.google.com/d/msgid/vim_use/f6af7426-dada-45c8-a674-ba3abd4a3119%40gmail.com.

Re: Backup Directory

hi,

On Mon, 9 Mar 2026 at 11:59, CrestChristopher
<crestchristopher@gmail.com> wrote:
> ...
> Although I typed out the full home path where the .backup directory is located query the path returned; backupdir=~/.backup//
> In this case, after typing something in vim, and quitting without saving; there was no backup saved in the backupdir path ?

fwiw, the line in my '~/.vimrc' reads:
set backupdir=/tmp,~/tmp

no trailing slashes, works for me.

--
regards, jr.

You have the right to free speech, as long as you're not dumb enough
to actually try it.
(The Clash 'Know Your Rights')

this email is intended only for the addressee(s) and may contain
confidential information. if you are not the intended recipient, you
are hereby notified that any use of this email, its dissemination,
distribution, and/or copying without prior written consent is
prohibited.

--
--
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 visit https://groups.google.com/d/msgid/vim_use/CAM-dBgom-JnUx756OX5ZbLTAa0-RnO31soTyoSD92FqDEbQU%2Bg%40mail.gmail.com.

Re: Backup Directory

On Mo, 09 Mär 2026, CrestChristopher wrote:

> Although I typed out the full home path where the .backup directory is
> located query the path returned; backupdir=~/.backup//
>
> In this case, after typing something in vim, and quitting without
> saving; there was no backup saved in the backupdir path ?

I believe backup is only ever done when saving a file, not from
arbitrary points in time. There are however plugins available that do
this. Perhaps you should start explain, what exactly you are trying to
achieve?

Thanks,
Christian
--
Just don't create a file called -rf. :-)
-- Larry Wall in <11393@jpl-devvax.JPL.NASA.GOV>

--
--
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 visit https://groups.google.com/d/msgid/vim_use/aa67jf6lcpXy8Qxz%40256bit.org.

Re: Backup Directory


On 3/9/2026 7:48 AM, Christian Brabandt wrote:
Please keep the reply on the vim-use list, forwarding to vim-use for   reference.    On Mo, 09 Mär 2026, CrestChristopher wrote:    
Vim returns no error;        set backupdir="$HOME/.backup" I've also tried        set backupdir="/etc/.backup  
  This basically is the same as    :set backupdir=     e.g. because of the double quote acting as a comment character, you are   effectively emptying the option value.    You probably want:    :set backupdir=~/.backup//    note the trailing double slashes to ensure that backup files are written   with full path names, where slashes are replaced by % signs, as   documented at :h 'backupdir'. Please also note: I am not hundert percent   sure if Vim expands the "~" automatically, but I believe it does. If   not, you may want to explicitly spell out your home directory like this:    :set backupdir=/home/user/.backup//    Finally please note, you can always check the value by querying the   option setting directly:    :set backupdir?    
    set writebackup  
  This will create a backup, but will delete the backup file after a   successful write. Is that what you want? Or do you want to keep the   backups in which case you want    :set backup    Thanks,  Christian

Although I typed out the full home path where the .backup directory is located query the path returned; backupdir=~/.backup//

In this case, after typing something in vim, and quitting without saving; there was no backup saved in the backupdir path ?

Re: Backup Directory

Please keep the reply on the vim-use list, forwarding to vim-use for
reference.

On Mo, 09 Mär 2026, CrestChristopher wrote:

> Vim returns no error;
>
> set backupdir="$HOME/.backup" I've also tried
>
> set backupdir="/etc/.backup

This basically is the same as

:set backupdir=

e.g. because of the double quote acting as a comment character, you are
effectively emptying the option value.

You probably want:

:set backupdir=~/.backup//

note the trailing double slashes to ensure that backup files are written
with full path names, where slashes are replaced by % signs, as
documented at :h 'backupdir'. Please also note: I am not hundert percent
sure if Vim expands the "~" automatically, but I believe it does. If
not, you may want to explicitly spell out your home directory like this:

:set backupdir=/home/user/.backup//

Finally please note, you can always check the value by querying the
option setting directly:

:set backupdir?

> set writebackup

This will create a backup, but will delete the backup file after a
successful write. Is that what you want? Or do you want to keep the
backups in which case you want

:set backup

Thanks,
Christian
--
Wenn es etwas ist, das "jeder weiß", dann stimmt es garantiert nicht.
-- Robert Anson Heinlein (Die Leben des Lazarus Long)

--
--
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 visit https://groups.google.com/d/msgid/vim_use/aa6zhDZ0gKycJhBe%40256bit.org.

Re: Backup Directory

On So, 08 Mär 2026, Christopher wrote:

> Putting it in quotes, causes vim to fire an error; although nothing is being written ?

... and the error is what? You may want to share what exactly you put
into your .vimrc.

Also please let me remind you of the list etiquette:

> Do not top-post! Type your reply below the text you are replying to.

Thanks,
Chris
--
Substantial penalty for early withdrawal.

--
--
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 visit https://groups.google.com/d/msgid/vim_use/aa5whg%2Bbvs9ZQK00%40256bit.org.