From 257a4f071b79533eee6245b039f67454f0748a3b Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 14 Sep 2023 12:02:56 +0200 Subject: Fix gitsigns keys --- fnl/plugins/editor/gitsigns.fnl | 100 ++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 55 deletions(-) (limited to 'fnl') diff --git a/fnl/plugins/editor/gitsigns.fnl b/fnl/plugins/editor/gitsigns.fnl index 1dc74c7..a89956a 100644 --- a/fnl/plugins/editor/gitsigns.fnl +++ b/fnl/plugins/editor/gitsigns.fnl @@ -1,55 +1,49 @@ ;; Add git signs to source files. -(local mappings [[:n - :mq - "Gitsigns diffthis HEAD" - {:desc "Gitsigns diff"}] - [:n - :gR - "lua require 'gitsigns'.reset_buffer()" - {:desc "Reset Buffer"}] - [:n - :gd - "Gitsigns diffthis HEAD" - {:desc :Diff}] - [:n - :gj - "lua require 'gitsigns'.next_hunk()" - {:desc "Next Hunk"}] - [:n - :gk - "lua require 'gitsigns'.prev_hunk()" - {:desc "Prev Hunk"}] - [:n - :gl - "lua require 'gitsigns'.blame_line()" - {:desc :Blame}] - [:n - :gp - "lua require 'gitsigns'.preview_hunk()" - {:desc "Preview Hunk"}] - [:n - :gr - "lua require 'gitsigns'.reset_hunk()" - {:desc "Reset Hunk"}] - [:n - :gs - "lua require 'gitsigns'.stage_hunk()" - {:desc "Stage Hunk"}] - [:n - :gu - "lua require 'gitsigns'.undo_stage_hunk()" - {:desc "Undo Stage Hunk"}] - [[:o :x] - :gn - ":Gitsigns select_hunk" - {:desc "GitSigns Select Hunk"}]]) - -(fn on-attach [bufnr] - (each [_ mapping (ipairs mappings)] - (match mapping - [mode key cmd desc] - (vim.keymap.set mode key cmd (vim.tbl_extend :force {:buffer bufnr} desc))))) +(local keys [{1 :mq + 2 "Gitsigns diffthis HEAD" + :mode :n + :desc "Gitsigns diff"} + {1 :gR + 2 "lua require 'gitsigns'.reset_buffer()" + :mode :n + :desc "Reset Buffer"} + {1 :gd + 2 "Gitsigns diffthis HEAD" + :mode :n + :desc :Diff} + {1 :gj + 2 "lua require 'gitsigns'.next_hunk()" + :mode :n + :desc "Next Hunk"} + {1 :gk + 2 "lua require 'gitsigns'.prev_hunk()" + :mode :n + :desc "Prev Hunk"} + {1 :gl + 2 "lua require 'gitsigns'.blame_line()" + :mode :n + :desc :Blame} + {1 :gp + 2 "lua require 'gitsigns'.preview_hunk()" + :mode :n + :desc "Preview Hunk"} + {1 :gr + 2 "lua require 'gitsigns'.reset_hunk()" + :mode :n + :desc "Reset Hunk"} + {1 :gs + 2 "lua require 'gitsigns'.stage_hunk()" + :mode :n + :desc "Stage Hunk"} + {1 :gu + 2 "lua require 'gitsigns'.undo_stage_hunk()" + :mode :n + :desc "Undo Stage Hunk"} + {1 :gn + 2 ":Gitsigns select_hunk" + :mode [:o :x] + :desc "GitSigns Select Hunk"}]) (local icons (require :plugins.icons)) @@ -84,8 +78,4 @@ :col 1} :yadm {:enable false}}) -{1 :lewis6991/gitsigns.nvim - :event [:BufReadPost :BufNewFile] - : opts - :on_attach (fn [bufnr] - (on-attach bufnr))} +{1 :lewis6991/gitsigns.nvim :event [:BufReadPre :BufNewFile] : opts : keys} -- cgit v1.2.3-70-g09d2