Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


fugitive.vim: a Git wrapper so awesome, it should be illegal

Subscribe to updates I use vim-fugitive

Statistics on vim-fugitive

Number of watchers on Github 9218
Number of open issues 275
Average time to close an issue 16 days
Main language VimL
Average time to merge a PR 3 days
Open pull requests 67+
Closed pull requests 71+
Last commit over 2 years ago
Repo Created over 10 years ago
Repo Last Updated over 2 years ago
Size 877 KB
Homepage http://www.vim.or...
Organization / Authortpope
Page Updated
Do you use vim-fugitive? Leave a review!
View open issues (275)
View vim-fugitive activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating vim-fugitive for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time. Check out these features:

View any blob, tree, commit, or tag in the repository with :Gedit (and :Gsplit, :Gvsplit, :Gtabedit, ...). Edit a file in the index and write to it to stage the changes. Use :Gdiff to bring up the staged version of the file side by side with the working tree version and use Vim's diff handling capabilities to stage a subset of the file's changes.

Bring up the output of git status with :Gstatus. Press - to add/reset a file's changes, or p to add/reset --patch. And guess what :Gcommit does!

:Gblame brings up an interactive vertical split with git blame output. Press enter on a line to edit the commit where the line changed, or o to open it in a split. When you're done, use :Gedit in the historic buffer to go back to the work tree version.

:Gmove does a git mv on a file and simultaneously renames the buffer. :Gdelete does a git rm on a file and simultaneously deletes the buffer.

Use :Ggrep to search the work tree (or any arbitrary commit) with git grep, skipping over that which is not tracked in the repository. :Glog loads all previous revisions of a file into the quickfix list so you can iterate over them and watch the file evolve!

:Gread is a variant of git checkout -- filename that operates on the buffer rather than the filename. This means you can use u to undo it and you never get any warnings about the file changing outside Vim. :Gwrite writes to both the work tree and index versions of a file, making it like git add when called from a work tree file and like git checkout when called from the index or a blob in history.

Use :Gbrowse to open the current file on the web front-end of your favorite hosting provider, with optional line range (try it in visual mode!). Built-in support is provided for git instaweb, and plugins are available for popular providers such as GitHub, GitLab, and Bitbucket.

Add %{fugitive#statusline()} to 'statusline' to get an indicator with the current branch in (surprise!) your statusline.

Last but not least, there's :Git for running any arbitrary command, and Git! to open the output of a command in a temp file.



If you don't have a preferred installation method, one option is to install pathogen.vim, and then copy and paste:

cd ~/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git
vim -u NONE -c "helptags vim-fugitive/doc" -c q

If your Vim version is below 7.2, I recommend also installing vim-git for syntax highlighting and other Git niceties.


I installed the plugin and started Vim. Why don't any of the commands exist?

Fugitive cares about the current file, not the current working directory. Edit a file from the repository.

I opened a new tab. Why don't any of the commands exist?

Fugitive cares about the current file, not the current working directory. Edit a file from the repository.

Why is :Gbrowse not using the right browser?

:Gbrowse delegates to git web--browse, which is less than perfect when it comes to finding the right browser. You can tell it the correct browser to use with git config --global web.browser .... On macOS, for example, you might want to set this to open. See git web--browse --help for details.

Here's a patch that automatically opens the quickfix window after :Ggrep.

This is a great example of why I recommend asking before patching. There are valid arguments to be made both for and against automatically opening the quickfix window. Whenever I have to make an arbitrary decision like this, I ask what Vim would do. And Vim does not open a quickfix window after :grep.

Luckily, it's easy to implement the desired behavior without changing fugitive.vim. The following autocommand will cause the quickfix window to open after any grep invocation:

autocmd QuickFixCmdPost *grep* cwindow


Like fugitive.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.


Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-fugitive open issues Ask a question     (View All Issues)
  • over 3 years Gdiff splits wrong window
  • over 3 years showing errors when I push or pull
  • over 3 years Git worktree and fugitive issues
  • over 3 years Feature request: Gbrowse blame
  • over 3 years Support skywind3000/asyncrun.vim as replacement for tpope/vim-dispatch
  • over 3 years Cannot sign commits when GPG key requires a password
  • over 3 years fugitive: "origin' is not a supported remote
  • over 3 years Cannot stage file from status window on just one project
  • almost 4 years Glog Error processing BufReadCmd Auto commands
  • almost 4 years File type not detected under git worktree
  • almost 4 years undo in one of the side buffers during a merge conflict resolve messed up current merge conflict
  • almost 4 years Undo discard ("U") from status window doesn't work
  • almost 4 years Autocommands do not fire for files named `index`
  • almost 4 years Empty buffer_path when repo tree is a symlink
  • almost 4 years Prevent myself from editing git file after diff
  • almost 4 years I need to type `:Gwrite` twice in order to add a file
  • almost 4 years Can not track files if there are Chinese characters in the folder name
  • almost 4 years Renamed file with changes renamed to original file when unstaging
  • almost 4 years ":Git rebase -i" not working with neovim
  • almost 4 years Split layout changed after closing Gstatus window
  • about 4 years Force Gstatus to split above
  • about 4 years Move cursor directly to the first modified or untracked file in GStatus
  • about 4 years Diffing again in Gstatus diffs in the preview window
  • about 4 years U on untrack files does not work (on windows 10)
  • about 4 years Gremove is not wiping out the buffer
  • about 4 years Provide an easier API to get the absolute file path
  • about 4 years Provide an API / option to get shortened commit
  • about 4 years RFE: support for the interactive rebase
  • about 4 years what happens when adding a "!" after the G command
  • about 4 years Add Gstatusdo command
vim-fugitive open pull requests (View All Pulls)
  • Resolve symbolic links in BufNewFile/BufReadPost
  • Move most code to the autoload directory.
  • Add diff in new tab commands
  • Document StageUndo key map (U) in :Gstatus
  • Add FAQ entry for adding custom github domains.
  • add support for fish shell syntax
  • Better handling of stashes
  • Add support for git core.commentChar configuration
  • Detect 'git worktree add' checkouts
  • Fixes for submodules with native Vim and Cygwin Git under MSW.
  • diffoff_all: restore '#' window, use winrestcmd
  • Add AppStream metadata.
  • Add feature: Open a commit or file by double-clicking
  • [WIP] Add range support to :Gwrite
  • use same escaping for cmd and powershell
  • Add :Gwn, :Gwp, and :GwN commands
  • Feature: Add command to vertically split a commit on Gblame
  • use more exact time regex for Gblame
  • fix :diffoff!
  • Add fugitive#execute_with_message_buffer()
  • Add the :Gtag command for tag creation
  • Add :Glsfiles, :Gllsfiles commands
  • Misc changes for fugitive
  • Show status flag of repo in statusline
  • working mockup of 'p' and '!' support for preview-window blaming
  • Add STAGING PARTIAL CHANGES topic to documentation
  • Fix for empty buffer :Git command in Neovim
  • worktree: warn the user that their worktree is broken
  • Add Gtcd command
  • Ggrep: use current working directory
  • Gstatus: Map cF to `Gcommit --fixup=HEAD`.
  • RFC: Gsdiff: split horizontally with diffopt+=vertical
  • Add shortcuts for getting hunks from other views of the diff.
  • Allow paragraph motion in gitcommit buffers
  • Follow symlinks
  • commit --fixup
  • ctag detection for submodules, recursive or otherwise
  • Show :Gstatus at full-width top for vertical diff splits
  • Add ssh://git@ remote support
  • Add a bit of documentation for d2o and d3o commands.
  • Fix worktree issues in MSYS2/Cygwin environment
  • doc: prefer https url
  • Add FAQ for GitHub for Windows
  • Use %delete_ to delete all the lines in the buffer
  • Trigger Autocommands after changing windows from autocmd
  • Add keybindings for interactive rebase
  • Support the master... format in :Gdiff
  • :terminal in s:Dispatch to prevent freezing neovim.
  • Fix laggy blame scrolling
  • Implement pushing the current branch upstream
  • Support `vim -c Gcommand`
  • Link README to full docs & mention '%' vs <C-R><C-G> for :Gcommit
  • Fix Gblame not being able to show any specific commit on Windows
  • Add Gbrowse returning shortened URL
  • Allow custom fugitive#statusline prefix and suffix
  • Fix inconsistent documentation in README
  • Added git checkout --theirs/--ours support for Gstatus
  • Checkout multiple files in visual mode #944
  • Replace.cmd: make sure, the window stays the same
  • Documented how to get to the current file from any fugitive-revison
  • Resolve symlinks in repo().tree()
  • Show commit in Gblame'd detail window
  • Fix diffoff command.
  • Vim8 terminal support
  • Removing change directory step from pathogen installation step.
  • Add 'git checkout --patch' to Gstatus.
  • Fix Gsdiff not always opening horizontal split
vim-fugitive questions on Stackoverflow (View All Questions)
  • Gstatus changed behaviour in vim-fugitive
  • How can i view git diff for any commit using vim-fugitive?
  • Starting vim-fugitive from command line
  • having no output for Gstatus in vim-fugitive plugin for vim
  • Diff of current and previous version using vim-fugitive
  • Vim Fugitive: Gblame reblame options
  • Vim-fugitive not matching Git command line
  • Jump to the line which says `modifed...` while using :Gstatus in vim-fugitive
  • Installing vim-fugitive on windows 7
  • Vim fugitive plugin does not recognise git archive on Windows
  • VIM fugitive plugin: how to run :Gwrite command with a -f parameter to force add a file from .gitignore?
vim-fugitive list of languages used
  • Vim script
Other projects in VimL