Monday, March 9, 2026

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 ?

No comments: