Monday, March 9, 2026

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.

No comments: