From d9c432508ac0f27d408ca237b7a31219e4d7e4c1 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Tue, 17 Dec 2024 09:33:01 +1030 Subject: [PATCH] fix: fugitive git log command --- .config/nvim/lua/plugins/fugitive.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/plugins/fugitive.lua b/.config/nvim/lua/plugins/fugitive.lua index 7e0888b..bba8684 100644 --- a/.config/nvim/lua/plugins/fugitive.lua +++ b/.config/nvim/lua/plugins/fugitive.lua @@ -26,14 +26,16 @@ return { local opts = { noremap = true, silent = true } - vim.keymap.set("n", "gg", "Git", opts) + vim.keymap.set("n", "gg", function () + vim.cmd("Git") + end, opts) vim.keymap.set("v", "gl", function() - local startPos = vim.fn.getpos("'<") - local endPos = vim.fn.getpos("'>") + local startPos = vim.fn.getpos("v") + local endPos = vim.fn.getpos(".") - local startLine = startPos[2] - local endLine = endPos[2] + local startLine = math.min(startPos[2], endPos[2]) + local endLine = math.max(startPos[2], endPos[2]) if startLine == 0 or endLine == 0 then vim.notify(vim.inspect(vim.fn.getpos("'<")) .. " to " .. vim.inspect(vim.fn.getpos("'>")))