Home Explore Blog CI



neovim

14th chunk of `runtime/doc/options.txt`
1fa2d77002b55bf45a125c84b95a60304b0179d5bd69a2d00000000100000fa0
 file was changed (through the file descriptor) will check the
	backup file instead of the newly created file.  "crontab -e" is an
	example, as are several |file-watcher| daemons like inotify.  In that
	case you probably want to switch this option.

	When a copy is made, the original file is truncated and then filled
	with the new text.  This means that protection bits, owner and
	symbolic links of the original file are unmodified.  The backup file,
	however, is a new file, owned by the user who edited the file.  The
	group of the backup is set to the group of the original file.  If this
	fails, the protection bits for the group are made the same as for
	others.

	When the file is renamed, this is the other way around: The backup has
	the same attributes of the original file, and the newly written file
	is owned by the current user.  When the file was a (hard/symbolic)
	link, the new file will not!  That's why the "auto" value doesn't
	rename when the file is a link.  The owner and group of the newly
	written file will be set to the same ones as the original file, but
	the system may refuse to do this.  In that case the "auto" value will
	again not rename the file.

						*'backupdir'* *'bdir'*
'backupdir' 'bdir'	string	(default ".,$XDG_STATE_HOME/nvim/backup//")
			global
	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.  If none of the directories exist Nvim will
	  attempt to create the last directory in the list.
	- 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 swap 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: >vim
	    set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
<
	See also 'backup' and 'writebackup' options.
	If you want to hide your backup files on Unix, consider this value: >vim
		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.

					*'backupext'* *'bex'* *E589*
'backupext' 'bex'	string	(default "~")
			global
	String which is appended to a file name to make the name of the
	backup file.  The default is quite unusual, because this avoids
	accidentally overwriting existing files with a backup file.  You might
	prefer using ".bak", but make sure that you don't have files with
	".bak" that you want to keep.
	Only normal

Title: Vim Options: backupcopy (continued), backupdir, and backupext
Summary
This section continues the explanation of 'backupcopy', detailing how file attributes and ownership are handled when creating backups through copying or renaming. It then describes the 'backupdir' option, which specifies a list of directories where backup files are stored, including special handling for paths and environment variables. Finally, it covers the 'backupext' option, which determines the file extension used for backup files, cautioning against overwriting existing files.