Skip to content

Commit

Permalink
Use non-0 exit code when quitting
Browse files Browse the repository at this point in the history
Currently hunk uses `:qa` to exit when the quit keybinding is pressed.
This works fine during a split because the output directory will be
identical to the current changeset but this does not work when
performing an operation like squash.

This is because the squash operation will proceed with the entire
changeset instead of being cancelled.

This updates the quit binding to use `:cq` instead, which exits with a
status code of 1.
  • Loading branch information
julienvincent committed Aug 21, 2024
1 parent 5bf45e0 commit 8a35aec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/hunk/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ local function set_global_bindings(layout, buf)

for _, chord in ipairs(utils.into_table(config.keys.global.quit)) do
vim.keymap.set("n", chord, function()
vim.cmd("qa")
vim.cmd("cq")
end, {
buffer = buf,
})
Expand Down

0 comments on commit 8a35aec

Please sign in to comment.