Timeline for Make backup only once per session, when I close a file
Current License: CC BY-SA 3.0
25 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Feb 25, 2018 at 16:18 | history | bounty ended | Arch Stanton | ||
S Feb 25, 2018 at 16:18 | history | notice removed | Arch Stanton | ||
Feb 25, 2018 at 16:18 | vote | accept | Arch Stanton | ||
Feb 21, 2018 at 7:33 | comment | added | Christian Brabandt |
Have you had a look at :h backup-table . Please also check the various backup options, especially :h 'backupcopy' and :h 'backupskip'
|
|
Feb 20, 2018 at 19:42 | answer | added | Rich | timeline score: 3 | |
Feb 20, 2018 at 18:53 | comment | added | cprn |
I still don't understand your question fully. Maybe what you want is to cnoremap w w\|!cp % %.backup ?
|
|
Feb 20, 2018 at 18:44 | answer | added | cprn | timeline score: 1 | |
Feb 20, 2018 at 12:18 | history | edited | Arch Stanton | CC BY-SA 3.0 |
added 178 characters in body
|
Feb 20, 2018 at 12:08 | comment | added | Rich | "I often find myself wishing that I could see a file as it was at the beginning of the editing session (for files that I don't want to keep under version control)." <- I think this is information that would be useful in the question body, rather than just in the comments. Like Tumbler41, I didn't really understand your question till I read the comment that contains it. | |
Feb 20, 2018 at 11:41 | answer | added | raul.vila | timeline score: 1 | |
Feb 19, 2018 at 18:13 | comment | added | Arch Stanton |
@Tumbler41 I've read through :help backup and it doesn't look like it there's some settings to do it with the built-in option, indeed. I was hoping on a plug-in or some code to add to my vimrc . I don't know how to write this extension by myself.
|
|
Feb 19, 2018 at 18:08 | comment | added | Tumbler41 |
Not sure if the backup option can do this by default. It might be easier just to make your own backup using the BufReadPre and BufLeave autocmds.
|
|
Feb 19, 2018 at 18:03 | history | edited | Tumbler41 | CC BY-SA 3.0 |
added 27 characters in body
|
Feb 19, 2018 at 18:00 | history | edited | Arch Stanton | CC BY-SA 3.0 |
added 189 characters in body
|
Feb 19, 2018 at 17:59 | comment | added | Tumbler41 |
I understand your question now. Unfortunately I don't know much about the backup option. Can you put some of those details into the question body?
|
|
Feb 19, 2018 at 17:57 | comment | added | Arch Stanton | One clarification, 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. Maybe it's a bit convoluted, but I often find myself wishing that I could see a file as it was at the beginning of the editing session (for files that I don't want to keep under version control). | |
Feb 19, 2018 at 17:52 | comment | added | Arch Stanton |
I'm referring to the file that ends in ~
|
|
Feb 19, 2018 at 17:51 | comment | added | Tumbler41 |
And the backup that you're referring to is the .swp file?
|
|
Feb 19, 2018 at 17:47 | comment | added | Arch Stanton | @Tumbler41 Nope, I'm saying I don't want to write to the backup until I close the buffer, so the backup remains a copy of the actual file as it was at the beginning of the editing session. As it is now the backup is the copy of the last saved version of the actual file. | |
Feb 19, 2018 at 17:40 | comment | added | Tumbler41 | So you're saying you don't want to write to the actual file until you close the buffer? Can I ask why you want this behavior? | |
S Feb 19, 2018 at 15:50 | history | bounty started | Arch Stanton | ||
S Feb 19, 2018 at 15:50 | history | notice added | Arch Stanton | Draw attention | |
Feb 19, 2018 at 15:49 | history | edited | Arch Stanton | CC BY-SA 3.0 |
added 16 characters in body
|
Feb 13, 2018 at 21:40 | history | edited | Arch Stanton |
edited tags
|
|
Feb 13, 2018 at 20:29 | history | asked | Arch Stanton | CC BY-SA 3.0 |