feat(bufdelete): added an option to cancel closing multiple buffers with bufdelete #1514
+6
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When using bufdelete close all on multiple unsaved buffers, and choosing cancel when the prompt shows up, bufdelete continues to try to close the following buffers as well.
This behavior is a little strange, if I would want to save the buffer, I would have chosen yes, if I wanted to discard the changes, I would have chosen no. If I chose cancel/Ctrl-C the logical thing would be cancel the whole bulk operation and let the user perform any modifications they might deem necessary before proceeding.
This would allow a user to define an autocommand on PreExit to call bufdelete all and get a prompt for each unsaved buffer, deciding if he would like to save the changes or not, and also allowing to cancel the whole operation and stop nvim from exiting. This behavior is the normal behavior in numerous application including office applications preventing unintentional data loss.
This PR provides the described desired functionality
Related Issue(s)