Skip to main content
4 of 6
added 189 characters in body

Make backup only once per session, when I close a file

I'd like vim to keep the backup of a file until that file is closed, instead of overwriting the backup every time the file is saved. How can I do that?

NB: the backup should become a copy of the file as the file was when I last saved it before closing. That is, if I edit a file and quit without saving, the backup should not be written.