For example, I'll use VIM to code a Python script and then save the file.
When I navigate to the directory I saved in and use the ls
command, up comes:
test_file.py
test_file.py~
Are these backup files?
For example, I'll use VIM to code a Python script and then save the file.
When I navigate to the directory I saved in and use the ls
command, up comes:
test_file.py
test_file.py~
Are these backup files?
Yes, the files that end with the tilde (~
) are backups of files right before you edited it.
These backups will be handy if you experience a crash. If you want to save them in another directory, you can add this to your .vimrc:
set backupdir=~/vim_tmp,.
set directory=~/vim_tmp,.
where ~/vim_tmp
is the directory you want to store your backup files.
Yes, they are automatic backup files.
I have this in my .vimrc:
set writebackup " Write a backup when saving a file...
set nobackup " ...but delete the backup upon successful completion of the save.
Here are the possiblities:
'backup' 'writebackup' action
off off no backup made
off on backup current file, deleted afterwards (default)
on off delete old backup, backup current file
on on delete old backup, backup current file
I also have
set backupdir=$VIM/backup
so that all of my backup files are in the same location, rather than the location of the original file.
See :help backup
for more.
Yes, they are vim backup files. (if you use default backup file extension)
To disable backup in vim:
set nobk
set nowb
you may want to check
:h 'bk'
and :h 'wb'
for detail.
@hek2mgl
if one uses the default backup file name extension, it is tilde ~
. for detail you could check :h 'bex'
:
'backupext' 'bex' string (default "~", for VMS: "_")
global
{not in Vi}
String which is appended to a file name to make the name of the
backup file.