On Sun, Feb 12, 2017 at 5:17 AM, thecliguy <[email protected]> wrote:
> I am running the following version of Vim on Windows 10:
>
> VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov  6 2016 17:05:36)
> MS-Windows 32-bit console version
> Included patches: 1-69

Note that the latest bleeding-edge patchlevel is 8.0.326, or 8.0.324
if you don't count "tests-only" fixes. The latte was released this
past Thursday.
>
> I have observed that upon editing a file and writing the changes, an
> additional file is created, the name of which is the same as the original
> but with ~ appended to it. This additional file contains the content prior
> to the write and remains even after having closed Vim.
>
> I wanted to know whether it is the expected behaviour that the backup file
> remains even once Vim has been closed, I therefore consulted the help...
>
> The help topic backup-table refers to two settings (backup and writebackup)
> which are responsible for the circumstances under which a backup file is
> created.
>
> Although my user vimrc file ($HOME\_vimrc) doesn't directly contain a
> reference to either backup and/or writebackup, the first line in the file is
> source $VIMRUNTIME/vimrc_example.vim, which does contain such a reference.
> According to the logic within $VIMRUNTIME/vimrc_example.vim, backup is
> enabled for any operating system other than 'VMS':
>
> if has("vms")
>   set nobackup " do not keep a backup file, use versions instead
> else
>   set backup " keep a backup file (restore to previous version)
>   if has('persistent_undo')
>     set undofile " keep an undo file (undo changes after closing)
>   endif
> endif
>
> Whilst consulting the help, I discovered another topic backup-changed, which
> suggests that the backup option used to be on by default (in previous
> versions of Vim) but is now off by default:
>
> The default value for 'backup' used to be on.  This resulted in a backup
> file
> being made when the original file was overwritten.
>
> Now the default for 'backup' is off.  As soon as the writing of the file has
> successfully finished, the backup file is deleted.  If you want to keep the
> backup file, set 'backup' on in your vimrc.  The reason for this change is
> that many people complained that leaving a backup file behind is not
> Vi-compatible.
>
> So my question is, why does $VIMRUNTIME/vimrc_example.vim enable backup in
> contradiction to the backup-changed help topic which states that it is
> supposed to be off by default?

The recommended setting for "medium" and larger builds, which are
compiled with +writebackup, is

    set nobackup writebackup

This way, Vim will create a temporary backup file just before
overwriting your editfile, erase it once (and if) the write is found
to have been successful, and leave no backups lying around. If you
still want to leave sleeping backups on your disks, you can, see

    :help 'backup'
    :help 'backupext'

and, in  fact, all the options whose name start with 'backup (plus
'writebackup' mentioned above).


Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui