Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/option/mod.ts>backupdir

๐Ÿ“š Standard module for denops.vim
Go to Latest
variable backupdir
import { backupdir } from "https://deno.land/x/denops_std@v5.0.1/option/mod.ts";

List of directories for the backup file, separated with commas.

  • The backup file will be created in the first directory in the list where this is possible. The directory must exist, Vim will not create it for you.

  • Empty means that no backup file will be created ('patchmode' is impossible!). Writing may fail because of this.

  • A directory "." means to put the backup file in the same directory as the edited file.

  • A directory starting with "./" (or "." for MS-Windows) means to put the backup file relative to where the edited file is. The leading "." is replaced with the path name of the edited file. ("." inside a directory name has no special meaning).

  • Spaces after the comma are ignored, other spaces are considered part of the directory name. To have a space at the start of a directory name, precede it with a backslash.

  • To include a comma in a directory name precede it with a backslash.

  • A directory name may end in an '/'.

  • For Unix and Win32, if a directory ends in two path separators "//", the backup file name will be built from the complete path to the file with all path separators changed to percent '%' signs. This will ensure file name uniqueness in the backup directory. On Win32, it is also possible to end with "\". However, When a separating comma is following, you must use "//", since "\" will include the comma in the file name. Therefore it is recommended to use '//', instead of '\'.

  • Environment variables are expanded :set_env.

  • Careful with '' characters, type one before a space, type two to get one in the option (see option-backslash), for example:

    :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
    
  • For backwards compatibility with Vim version 3.0 a '>' at the start of the option is removed. See also 'backup' and 'writebackup' options. If you want to hide your backup files on Unix, consider this value:

    set backupdir=./.backup,~/.backup,.,/tmp

You must create a ".backup" directory in each directory and in your home directory for this to work properly. The use of :set+= and :set-= is preferred when adding or removing directories from the list. This avoids problems when a future version uses another default. This option cannot be set from a modeline or in the sandbox, for security reasons.

(default for Amiga: ".,t:", for Win32: ".,$TEMP,c:/tmp,c:/temp" for Unix: ".,~/tmp,~/")