chrisbra / Recover.vim

A Plugin to show a diff, whenever recovering a buffer
http://www.vim.org/scripts/script.php?script_id=3068
248 stars 25 forks source link

Feature Request: Remove .swp file #7

Closed jgandt closed 12 years ago

jgandt commented 12 years ago

So I would love to use this plugin more, but I find myself skipping it and just editing or recovering manually.

My main issues is that i often just want to discard the .swp file. However, the diff is awesome to confirm that I'm not losing anything.

So instead of having to %diffg and then :FinishRecovery, it would be nice to have a ":TakeOnDiskVersion" or some such which simply removes the .swp and edits the on-disk version.

P.S. :FinishRecovery collides with :finish. kind of a pain...

Feel free to disregard. =)

Thanks

chrisbra commented 12 years ago

Thanks for the suggestion. I am not sure, I understand exactly what you want, but does commit b23b1d3 do what you want?

jgandt commented 12 years ago

The linked commit partially does what I want.

Let me come at it from a different angle.

Can you provide the diff counts when you prompt the user whether or not to show the diff buffer?

That is, when you detect that there is a swp file, pre-diff the swp and the on-disk version to check for differences.

Then, display the diff count between the two and notify the user if the swp and the on-disk are the same or different.

This would allow the user to quickly make a determination if they should even view the diff buffer.

This comes into play when you maybe lost a vim session and you don't come back to the project for a while. This would allow a user to say "oh man, DID that swp file contain any changes? Oh, it's the same as what is on disk so I'll just delete the swap and move on." OR: "oh yeah, it looks like there are some differences so I should launch the diff buffer and check what I changed and what I would lose if I just deleted the diff buffer."

Does this make sense?

Please let me know if I need to clarify more.

Thanks!

chrisbra commented 12 years ago

On Tue, August 14, 2012 16:13, jgandt wrote:

The linked commit partially does what I want.

Let me come at it from a different angle.

Can you provide the diff counts when you prompt the user whether or not to show the diff buffer?

That is, when you detect that there is a swp file, pre-diff the swp and the on-disk version to check for differences.

Then, display the diff count between the two and notify the user if the swp and the on-disk are the same or different.

This would allow the user to quickly make a determination if they should even view the diff buffer.

This comes into play when you maybe lost a vim session and you don't come back to the project for a while. This would allow a user to say "oh man, DID that swp file contain any changes? Oh, it's the same as what is on disk so I'll just delete the swap and move on." OR: "oh yeah, it looks like there are some differences so I should launch the diff buffer and check what I changed and what I would lose if I just deleted the diff buffer."

Does this make sense?

Please let me know if I need to clarify more.

Ok, I have implemented something like this. The 'Delete' option will now only be displayed, if both versions are the same.

Please test current HEAD.

regards, Christian

jgandt commented 12 years ago

Hi Christian,

The feature works exactly as expected.

Thanks so much for the quick turnaround.

.jpg