From 8a35aec1238e8a23c95c93b83409fb6969b237a4 Mon Sep 17 00:00:00 2001 From: Julien Vincent Date: Wed, 21 Aug 2024 12:41:44 +0100 Subject: [PATCH] Use non-0 exit code when quitting 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. --- lua/hunk/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/hunk/init.lua b/lua/hunk/init.lua index 22d812c..0f22000 100644 --- a/lua/hunk/init.lua +++ b/lua/hunk/init.lua @@ -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, })