summary refs log tree commit diff
path: root/.config/nvim/after/ftplugin/gitrebase.lua
blob: fb645345691ed219e45029f9eceed0563b48dd9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
vim.keymap.set('n', 'K', function()
  local commit = vim.fn.expand('<cword>')

  local content = nil
  require('mod.jobs').start({
    cmd = { 'git', 'show', '--patch', '--stat', commit },
    stdout_buffered = true,
    on_stdout = function(_, stdout)
      content = stdout
    end,
    on_exit = function()
      require('mod.win').popup(
        'git-show: ' .. commit,
        content,
        { buf = { filetype = 'gitcommit' } }
      )
    end,
  })
end, { desc = 'Lookup commit hash', buffer = 0 })