-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: change esc to act like cancel for change prompt #33
Conversation
edit accidentally selected the wrong issue. It should be #32 |
lua/bufdelete/init.lua
Outdated
@@ -40,7 +40,7 @@ local function buf_kill(range, force, wipeout) | |||
|
|||
-- If force is disabled, check for modified buffers in range. | |||
if not force then | |||
for bufnr, _ in pairs(target_buffers) do | |||
for bufnr, buf in pairs(target_buffers) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that was an artifact from a different approach I was taking. I just forgot to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
lua/bufdelete/init.lua
Outdated
target_buffers[bufnr] = nil | ||
end | ||
|
||
-- Clear message area. | ||
cmd.echo('""') | ||
cmd.redraw() | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this unnecessary newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lua/bufdelete/init.lua
Outdated
@@ -55,14 +55,15 @@ local function buf_kill(range, force, wipeout) | |||
|
|||
if choice == 's' or choice == 'S' then -- Save changes to the buffer. | |||
api.nvim_buf_call(bufnr, function() cmd.write() end) | |||
elseif choice == 'c' or choice == 'C' then -- Cancel, remove buffer from targets. | |||
elseif choice ~= 'i' and choice ~= 'I' then -- If not ignored, do not close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elseif choice ~= 'i' and choice ~= 'I' then -- If not ignored, do not close | |
elseif choice ~= 'i' and choice ~= 'I' then -- If not ignored, remove buffer from targets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
This PR changes the behavior of pressing escape when prompted for changes. Currently, the behavior of escape acts like ignore, allowing the buffer to be closed. This changes the behavior so that it acts like cancel.
Resolves #32
It's a quick hack and may be considered somewhat of a breaking change if folks were accustomed to pressing any key to close.