perf(git): minor performance cleanups
This commit is contained in:
+5
-1
@@ -2,8 +2,12 @@ local cr = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
|
||||
|
||||
vim.keymap.set("n", "<CR>", function()
|
||||
local worktree = vim.b.git_worktree
|
||||
-- Anchor past the leading graph chars (matches the leading sha column,
|
||||
-- not any hex word that happens to appear later in the subject).
|
||||
local sha = worktree
|
||||
and vim.api.nvim_get_current_line():match("(%x%x%x%x%x%x%x+)")
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user