Files
nvim/ftplugin/gitlog.lua
T

14 lines
511 B
Lua

local cr = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
vim.keymap.set("n", "<CR>", function()
local worktree = vim.b.git_worktree
local sha = worktree
and vim.api.nvim_get_current_line():match("(%x%x%x%x%x%x%x+)")
if sha then
require("git.show").open_commit(worktree, sha)
else
-- "n" mode = no remap, so this doesn't recurse into our mapping.
vim.api.nvim_feedkeys(cr, "n", false)
end
end, { buffer = 0, silent = true, desc = "Open commit" })