From 5e3a14596d290bec7f80ddde838dfd3844503f83 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 12 Jan 2026 21:31:37 +0000 Subject: [PATCH] add quickfix and location list mappings for gitsigns Added key mappings to send all hunks to the quickfix list and buffer hunks to the location list for improved navigation and management of git changes. --- README.md | 2 ++ lua/plugins/gitsigns.lua | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 9378af2..3cfde91 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,8 @@ Buffer-local keymaps available when inside a git repository: | n | `hp` | Preview hunk | | n | `hd` | Diff against index | | n | `hD` | Diff against previous commit (`~`) | +| n | `hq` | Send all hunks to quickfix list | +| n | `hl` | Send buffer hunks to location list | | o/x | `ih` | Text object: select git hunk | ### Telescope `lua/plugins/telescope.lua` diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index cb7fa2f..cc9de28 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -49,6 +49,10 @@ return { map('n', 'hp', gs.preview_hunk, { desc = 'Gitsigns: Preview hunk' }) map('n', 'hd', gs.diffthis, { desc = 'Gitsigns: Diff this' }) map('n', 'hD', function() gs.diffthis('~') end, { desc = 'Gitsigns: Diff this ~' }) + + -- Quickfix/Location list + map('n', 'hq', function() gs.setqflist('all') end, { desc = 'Gitsigns: All hunks to quickfix' }) + map('n', 'hl', function() gs.setloclist(0) end, { desc = 'Gitsigns: Buffer hunks to loclist' }) -- Text object map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'Gitsigns: Select hunk' })