gv.vim icon indicating copy to clipboard operation
gv.vim copied to clipboard

Add mapping to open commit in preview window

Open maujim opened this issue 4 years ago • 1 comments

Map p to open the commit in preview window. I'm happy to help work on this but I'm not sure where to start.

maujim avatar May 27 '21 01:05 maujim

Fugitive uses p to open in preview, but doesn't expose a command or function for other plugins to use that functionality. That means, you need to open the commit outside the preview window and then force the preview window to display it. Something like this would work but is likely to mess up your window layout:

nnoremap <buffer> p <Cmd>pclose<Bar>split<Bar>exec "Gedit" gv#sha()<Bar>pedit<Bar>close<CR>

Add that to ~/.vim/after/ftplugin/GV.vim.

Or you could figure out the correct fugitive:// path for the commit and :pedit that. Or, even better, get fugitive to expose a function to make this trivial.

idbrii avatar May 08 '23 17:05 idbrii