From 3df2ad0f1fcb06cc4da68f80aaa05e3c4f5c8c35 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 4 Mar 2022 16:29:54 +0100 Subject: [PATCH] home: vim: git: more visual mappings I cannot use the functions directly, as I would need to calculate the current selections begin and end points and use them as arguments. To be investigated. --- home/vim/plugin/settings/git.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home/vim/plugin/settings/git.vim b/home/vim/plugin/settings/git.vim index 7059f01..0deba6a 100644 --- a/home/vim/plugin/settings/git.vim +++ b/home/vim/plugin/settings/git.vim @@ -47,6 +47,15 @@ gitsigns.setup({ local visual = { ["ih"] = { gitsigns.select_hunk, "Git hunk" }, + + -- Only the actual command can make use of the visual selection... + ["g"] = { + name = "Git", + p = { ":Gitsigns preview_hunk", "Preview selection" }, + r = { ":Gitsigns reset_hunk", "Restore selection" }, + s = { ":Gitsigns stage_hunk", "Stage selection" }, + u = { ":Gitsigns undo_stage_hunk", "Undo stage selection" }, + }, } wk.register(keys, { buffer = bufnr })