Git wrapper for vim: fugitive.vim


Today’s browsing through “plugins that I haven’t made good enough use of” brings me to vim-fugitive:

:Gstatus pulls git status output into a vim split window. Pressing - on the line that a file is listed on either adds or removes a file from staging, and :Gcommit commits it.

:Gdiff opens a vertical split next to a file and uses vim’s diff facility to compare working copy to staged version.

:Gblame opens a vertical split next to a file with an interactive git blame output that tracks the source file as you scroll. Pressing on a line opens the commit that changed the code (or o to open in a split.)

:Glog opens the log in the quickfix window:

  • :copen to open the quickfix window to scroll through the versions
  • :ccl close the quickfix window
  • :cn go to the next error in the quickfix window (append a number to jump # steps)
  • :cp go to the previous error in the quickfix window (append a number to jump # steps)

:Gmove performs a git mv and modifies the buffer location as well.
:Gremove performs a git rm and removes the buffer as well.

Other commands of interest that I haven’t considered for my current workflow:
:Ggrep
:Gbrowse
:Git performs any other git command not already covered.
:Gedit, :Gsplit, :Gvsplit, :Gtabedit appear to open a repository object directly… not quite ready to pick at individual objects on that level.


%d bloggers like this: