Fugitive – a Git plugin for Vim
Do you like Git?
Do you like Vim ?
Then you will like “Fugitive” !
Fugitive is a Vim plugin that empowers you to manage many git commands from Vim.
Created by: Tim Pope
You can download Fugitive here:
Extract it in the directory:
or ~\vimfiles on Windows.
Go to the directory of your Git repository checkout,
for example, if working on ITK do:
Look at the equivalent of “git blame” by doing
It will produce the following screen:
will produce the following screen:
If, you start with simply “gvim” (with an empty file) and use the command:
you get to see first the branch where you are
if you hit ENTER on that line, you get the most recent commit in that branch
and if you hit ENTER again you get to see the diffs of that commit
moving now the cursor to one of the “diff” lines in green, and hitting ENTER,
will open the relevant file in diff mode with a vertically split window:
if you use the “:ls” command, you will notice that the files
are actually listed from their respective commits.
If you open a file, make some changes to it, and save those changes,
you can see the git differences by using the command:
You can also run from Vim any git command by using:
it will be equivalent to doing
for example, you could do:
:Git commit –amend
You can grep the content of the repository with the command:
and one of the most beautiful features…
If your remote is in Github, and you open a file in your local repository,
then from gvim you can type:
it will open that same file in your Web browser (in a new tab)
by using the navigation in the github web page
You could qualify it by selecting a filename, for example
For a full description of the many features,
read the “fugitive.txt” file that gets installed in
Happy Viming !