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("'>")))