Backups (recover) disabled by default: no backups
Bug #151791 reported by
Jeffrey Knight
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vim (Ubuntu) |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
Binary package hint: vim
I accidentally deleted some files I was working on, and wasn't too worried because I knew I could grab the swap file and :recover.
Much to my surprise, I had none.
I searched my entire file system and, sure enough, no vim backup files.
It wasn't until I added these to my vimrc that backups became enabled:
set backup
set writebackup
Some type of backup should be enabled by default. I understand not wanting to clutter
users' directories with ~backup files, so perhaps backups could default to /tmp.
This has been confirmed by David Portwood on Feisty and Gutsy:
https:/
Changed in vim: | |
importance: | Undecided → Wishlist |
status: | New → Triaged |
Changed in vim (Ubuntu): | |
status: | Triaged → Invalid |
To post a comment you must log in.
There are various modes that Vim uses for backups. By default ("set nobackup", "set writebackup"), a backup file is created just before saving and if the save is successful it is deleted. You can see a full explanation of the different backup behavior at ":help backup-table". You may also be interested in the 'backupdir' option in order to configure where Vim stores the backup files.
Backups are completely independent of the :recover command, though. That command is used to restore from a swap file, which would exist if Vim crashed while you were in the middle of editing or you lost power or something drastic along those lines.
So, in Vim's default configuration it does create both backup and swap files, but only temporally -- they're deleted as soon as they're not needed. This prevents littering the system with many extraneous files while still providing safeguards. That is the proper default behavior IMO and if you want different behavior, then you can configure Vim to behave differently.