Skip to content

How to copy the long hash of the commit under the cursor? #116

Answered by TamaMcGlinn
mbeko asked this question in Q&A
Discussion options

You must be logged in to vote

Put this autocmd in your flog augroup, in your vimrc:

augroup flog
    autocmd FileType floggraph nno <silent> yh :<C-U>call setreg('+', systemlist(flog#fugitive#GetGitCommand() . ' rev-parse ' . flog#Format("%(h)"))[0])<CR>
augroup END

Now yh copies the git hash into the '+' register, assuming you need it outside of vim. Otherwise, change that to the empty string for the default (unnamed) register, then just p will paste it.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mbeko
Comment options

Answer selected by mbeko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants