mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Add <leader>gf for lazygit commit history on current file
This commit is contained in:
parent
cca2e09149
commit
ad6eb7ed0b
1 changed files with 14 additions and 0 deletions
|
|
@ -129,6 +129,20 @@ map("n", "<leader>ub", function() Util.toggle("background", false, {"light", "da
|
|||
map("n", "<leader>gg", function() Util.terminal({ "lazygit" }, { cwd = Util.root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||
map("n", "<leader>gG", function() Util.terminal({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" })
|
||||
|
||||
-- Function to get the current file path from the root directory
|
||||
local current_file_path_from_root_dir = function()
|
||||
local path = vim.fn.expand("%:p")
|
||||
local root = Util.root()
|
||||
if not path:find(root, 1, true) then
|
||||
return path
|
||||
end
|
||||
return path:sub(#root + 2)
|
||||
end
|
||||
|
||||
map("n", "<leader>gf", function()
|
||||
Util.terminal({ "lazygit", "-f", current_file_path_from_root_dir() }, { esc_esc = false, ctrl_hjkl = false })
|
||||
end, { desc = "Lazygit current file history" })
|
||||
|
||||
-- quit
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue