explaingit

tpope/vim-fugitive

21,613Vim ScriptAudience · developerComplexity · 2/5MaintainedLicenseSetup · easy

TLDR

A Vim plugin that brings Git version control into your editor, letting you run Git commands and review changes without leaving Vim.

Mindmap

mindmap
  root((vim-fugitive))
    What it does
      Run Git commands
      View file history
      Compare versions
      Browse diffs
    Key features
      Colon-G shortcut
      Inline commit messages
      Scrollable output
      GitHub integration
    Use cases
      Review changes
      Stage commits
      Explore history
      Link to platforms
    Tech stack
      Vim
      Git
      Vim Script

Things people build with this

USE CASE 1

Review diffs and staged changes side-by-side without switching to a terminal.

USE CASE 2

Write commit messages directly in Vim and browse your file's Git history.

USE CASE 3

Stage specific changes and view old versions of files without leaving the editor.

USE CASE 4

Open the current file on GitHub or GitLab directly from Vim.

Tech stack

VimGitVim Script

Getting it running

Difficulty · easy Time to first run · 5min
Use freely under Vim's license terms, which permit modification and distribution for any purpose.

In plain English

vim-fugitive is a plugin for Vim, a terminal-based text editor, that integrates Git version control directly into the editor. Rather than switching to a separate terminal window to run Git commands, this plugin lets you run them from within Vim itself, with the results displayed sensibly inside the editor's interface. The core feature is the :Git command (also shortened to :G), which lets you run any standard Git command you already know. Beyond simply passing commands through, the plugin adds thoughtful behavior on top: quiet commands like git add run without interrupting your workflow, commands that need a text editor (like writing a commit message) open inside your current Vim session rather than launching a separate editor, and output-heavy commands like git log or git diff load into scrollable temporary buffers you can browse. A set of higher-level commands rounds out the feature set. You can view any historical version of a file, compare the working copy against the staged (ready-to-commit) version side by side, read an old version of a file back into the buffer, move or rename files through Git while keeping Vim in sync, and open the current file on platforms like GitHub or GitLab directly from the editor. You would use vim-fugitive if you live in Vim and want to manage Git without leaving the editor. It is especially useful for reviewing diffs, staging specific changes, writing commit messages, and exploring file history, all without context-switching to a terminal. It is written in Vim Script and follows Vim's own license terms.

Copy-paste prompts

Prompt 1
How do I use vim-fugitive to stage and commit changes without leaving Vim?
Prompt 2
Show me how to compare my working copy against the staged version using vim-fugitive.
Prompt 3
How do I view the Git history of a file and check out an old version with vim-fugitive?
Prompt 4
Can I open my current file on GitHub from within Vim using vim-fugitive?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.