Search code examples
vimvim-fugitive

How to Blame a particular revision in vim-fugitive


vim fugitive's Gblame is very good. Gblame annotates the current file and offers keyboard shortcuts like P, which annotates the parent-revision of the file form the blame window.

However, if i want to annotate a specific revision of a file, how do i do that?

I wish there was some thing like

:Gblame <commit-id> 

That would blame the current file as of the given commit-id..


Solution

  • Use :Gedit to view the current file at a certain commit and then run :Gblame

    :Gedit <commit-id>:%
    :Gblame
    

    We use % to represent the current file's name.

    For more help see:

    :h fugitive-:Gblame
    :h fugitive-:Gedit
    :h fugitive-revision
    :h cmdline-special
    :h :_%