-
I'm using fugitive for git blame buffer,
because I'm on the fugitiveblame buffer, it's not a file. any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
managed to figure it out: vim.api.nvim_buf_set_keymap(0, 'n', '<leader>gh', '', {
noremap = true,
silent = true,
desc = 'Open commit hash in browser',
callback = function()
local commit_hash = get_commit_hash()
vim.cmd 'wincmd p'
require('gitlinker').link {
action = function(url)
vim.ui.open(url)
end,
router = function(lk)
print(vim.inspect(lk))
local builder = 'https://'
-- host
builder = builder .. lk.host .. '/'
-- org
builder = builder .. lk.org .. '/'
-- repo
builder = builder .. (string_endswith(lk.repo, '.git') and lk.repo:sub(1, #lk.repo - 4) or lk.repo) .. '/'
-- rev
builder = builder .. 'commit/' .. lk.rev
return builder
end,
rev = commit_hash,
}
end,
}) |
Beta Was this translation helpful? Give feedback.
-
although it's working, I'd love a way to manually provide |
Beta Was this translation helpful? Give feedback.
managed to figure it out: