vim-fugitive README

The project's README from github.com/tpope/vim-fugitive. As one markdown file: README.md.

fugitive.vim

Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way, it's "so awesome, it should be illegal". That's why it's called Fugitive.

The crown jewel of Fugitive is :Git (or just :G), which calls any arbitrary Git command. If you know how to use Git at the command line, you know how to use :Git. It's vaguely akin to :!git but with numerous improvements:

Additional commands are provided for higher level operations:

Add %{FugitiveStatusline()} to 'statusline' to get an indicator with the current branch in your statusline.

For more information, see :help fugitive.

Screencasts

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/fugitive.git
vim -u NONE -c "helptags fugitive/doc" -c q

FAQ

What happened to the dispatch.vim backed asynchronous :Gpush and :Gfetch?

This behavior was divisive, confusing, and complicated inputting passwords, so it was removed. Use :Git! push to use Fugitive's own asynchronous execution, or retroactively make :Git push asynchronous by pressing CTRL-D.

Why am I getting core.worktree is required when using an external Git dir?

Git generally sets core.worktree for you automatically when necessary, but if you're doing something weird, or using a third-party tool that does something weird, you may need to set it manually:

git config core.worktree "$PWD"

This may be necessary even when simple git commands seem to work fine without it.

So I have a symlink and...

Stop. Just stop. If Git won't deal with your symlink, then Fugitive won't either. Consider using a plugin that resolves symlinks, or even better, using fewer symlinks.

Self-Promotion

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.

License

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

vim-fugitive (tpope/vim-fugitive)

Searching Database…

What is this?Fugitive is a Git wrapper that lives inside Vim — the README bills it as 'the premier Vim plugin for Git'. The name comes from its own tagline: a Git wrapper 'so awesome, it should be illegal'.
So is it a plugin inside my Vim, or a separate tool I run next to Git?It's a plugin written in Vim Script that loads into your editor and adds : commands like :Git — no separate binary or service. It always operates on the repository of the buffer you're in.
Do I need anything besides Vim to use it?Just Vim and a Git repo — it works wherever Vim does and always targets the repository of the current buffer. Since :Git mirrors the git CLI, knowing command-line Git is the real prerequisite.
Does everything from Git work through it, or are there gaps?A couple: symlinks that Git itself won't handle are unsupported, and the old dispatch.vim-backed async :Gpush/:Gfetch was removed — :Git! push or pressing CTRL-D gives you async instead.
Is it free, or is there a license catch?It's free — distributed under the same terms as Vim itself, with copyright by Tim Pope. The repo has been on GitHub since 2009 and sits at roughly 21.8k stars.
What can it actually do once it's installed?The heart is :Git (or just :G), which runs any arbitrary Git command — if you know Git at the command line, you already know it. Run bare :Git and you get a summary window of dirty files plus unpushed and unpulled commits (the successor to :Gstatus); :Git commit and :Git rebase -i do their editing right in your current Vim, and verbose output like :Git diff or :Git log loads into temporary buffers.
How does staging and diffing work inside it?:Gwrite stages the current file — it writes to both the work tree and the index, like git add. :Gread is an undoable checkout into the buffer, and :Gdiffsplit opens the staged version side by side with the working tree so you can edit the staged buffer and write to stage. :GMove and :GDelete wrap git mv and git rm on the current file.
What's the deal with :Git blame?It opens a temporary buffer with maps for triage: press Enter on a line to view the commit where it changed, or g? to see other maps. Without a filename it blames the currently edited file in a vertical, scroll-bound split. Relatedly, :Gedit HEAD~3:% loads the current file as it existed three commits ago.
Can it open a file on GitHub or GitLab?Yes — :GBrowse opens the current file on your hosting provider's web front-end, optionally limited to a visual-mode line range. GitHub, GitLab, Bitbucket, Gitee, Pagure, Phabricator, Azure DevOps and sourcehut are supported through companion plugins like rhubarb.vim and fugitive-gitlab.vim.
Creator
tpope
Size
2.6 MB
Stars
21.8K
Updated
CommitMar 07
Age
17y
Commits · 90 Days