Open-source project
airblade/vim-gitgutter avatar
airblade/vim-gitgutter

vim-gitgutter: Real-Time Git Diff Signs and Hunk Operations in Vim

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.

8,514 stars300 forksVim ScriptMIT

At a glance

What is it?
vim-gitgutter is a Vim plugin that shows added, modified, and removed lines in the sign column as you edit, and lets you stage, preview, or undo individual hunks without leaving Vim. It supports Vim 7.4 and later, runs diffs asynchronously, and never saves the buffer to do its work.
Who is it for?
vim-gitgutter is well suited for Vim and Neovim users who work exclusively with git and want per-hunk staging and undoing directly in the editor, without switching to a terminal. It is the wrong tool for projects that use SVN, Mercurial, or Perforce; use vim-signify instead.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 71 days ago.
What is it written in?
Mainly Vim Script, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What vim-gitgutter Does and Who It Is For

vim-gitgutter shows a git diff in the sign column of Vim or Neovim. As you edit a file tracked by git, the plugin computes the diff against the index (the staged state) and displays symbols in the narrow column at the left edge of the buffer: a plus sign for added lines, a tilde for modified lines, and a minus sign for removed lines. The signs update after a short idle delay, not on every keystroke.

The primary audience is Vim and Neovim users who want a continuous visual reminder of what has changed since the last commit, without switching to a terminal or calling git diff manually. Beyond displaying signs, the plugin provides full hunk-level operations: you can jump between hunks, stage a hunk directly from Vim, undo a hunk to revert it, and preview a hunk in a popup that highlights intra-line changes. Partial hunk staging is also supported, allowing you to stage only selected lines within a changed block.

The plugin name comes from a Sublime Text 3 plugin called GitGutter that inspired it in 2013.

Installing vim-gitgutter via Built-In Package Support

The simplest install uses Vim's native package management (available since Vim 8). For Vim:

code
mkdir -p ~/.vim/pack/airblade/start
cd ~/.vim/pack/airblade/start
git clone https://github.com/airblade/vim-gitgutter.git
vim -u NONE -c "helptags vim-gitgutter/doc" -c q

For Neovim:

code
mkdir -p ~/.config/nvim/pack/airblade/start
cd ~/.config/nvim/pack/airblade/start
git clone https://github.com/airblade/vim-gitgutter.git
nvim -u NONE -c "helptags vim-gitgutter/doc" -c q

After cloning, open a file in a git repository and make a change. Signs should appear automatically after the idle delay. The delay is controlled by Vim's updatetime option. The default is 4000ms (4 seconds), which makes the signs feel slow to appear. The README recommends setting it to around 100ms by adding this to your vimrc:

viml
set updatetime=100

Note that updatetime also controls when Vim writes its swap file; reducing it has that side effect as well. The signcolumn option must not be set to 'no', or the signs will have nowhere to appear.

Hunk Navigation and Operations

The default key mappings use the ]c and [c bindings to jump to the next and previous hunk respectively. Three leader-key mappings handle the core hunk operations: <leader>hp previews the hunk in a floating popup, <leader>hs stages the hunk, and <leader>hu undoes the hunk. The plugin does not support unstaging a staged hunk.

To remap the navigation keys, the README gives this example for binding ]h and [h:

viml
nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)

When you jump between hunks, the command line displays a message like 'Hunk 4 of 11' to show your position. Hunks can also be loaded into the quickfix list or the current window's location list, which allows navigation using standard Vim quickfix commands.

The plugin provides a hunk text object, so you can use visual selection or operator commands to operate on an entire hunk as a text unit. The plugin also supports folding all unchanged text, leaving only the changed lines visible, which is useful for reviewing a diff in a large file.

Configuration, Customization, and Edge Cases

vim-gitgutter exposes extensive configuration options through global variables. The maximum number of signs is unlimited in Vim 8.1.0614 or later and Neovim 0.4.0 or later; in older versions, the plugin suppresses signs when a file has more than 500 changes to avoid slowing the UI. The README gives the configuration variable for this:

viml
let g:gitgutter_max_signs = 500  " default value (Vim < 8.1.0614, Neovim < 0.4.0)
let g:gitgutter_max_signs = -1   " default value (otherwise)

Line highlighting (coloring the entire changed line) is available but off by default. Line number highlighting is also available but requires Vim 8.2.3874 or Neovim 0.3.2 or higher, and is also off by default.

On Windows, cmd.exe prioritizes the current folder over folders in PATH. If a file named git.* exists in the current folder, it will run instead of the git binary. The README recommends configuring the full path to the git executable: let g:gitgutter_git_executable = 'C:\Program Files\Git\bin\git.exe'

The plugin works with fish shell in addition to the standard shells, and heeds git's assume-unchanged bit. It preserves signs from other plugins, so running it alongside other sign-column tools does not cause conflicts.

Constraints: Git Only, FocusGained Dependency, and tmux

vim-gitgutter supports only git. The README is direct about this: 'If you work with other version control systems, I recommend vim-signify.' Teams that use SVN, Mercurial, or Perforce will find no useful functionality here.

The plugin relies on Vim's FocusGained autocommand to detect when the editor regains focus (for example, after switching away to a terminal and back). If your terminal emulator does not report focus events, the signs may not update when you return to Vim after making external git changes. The README gives two workarounds: install the Terminus plugin to configure focus reporting, or disable the dependency entirely with: let g:gitgutter_terminal_reports_focus=0

For tmux users, focus events must be enabled in the tmux configuration: set -g focus-events on in your tmux.conf. Without this, Vim inside tmux will not receive FocusGained events and signs may be stale.

The last push was on 2026-07-21. The plugin is compatible back to Vim 7.4.

Comparison with vim-signify

vim-signify is the natural alternative. The README explicitly recommends it for anyone working with version control systems other than git. vim-signify supports SVN, Mercurial, Perforce, CVS, and many others in addition to git, by calling each VCS's diff command.

The practical difference is scope. vim-signify shows signs for any supported VCS without requiring configuration. vim-gitgutter is git-only but exposes git-specific operations that vim-signify, being VCS-agnostic, cannot: staging individual hunks, undoing hunks to remove changes from the index, and previewing intra-line diffs. If your workflow is entirely git-based and you stage changes from inside Vim, vim-gitgutter provides operations that vim-signify does not. If your workflow uses mixed VCS or you only need visual indicators, vim-signify is the simpler choice.

The repository is licensed under MIT. There are no GitHub releases.

Editorial conclusion

vim-gitgutter is well suited for Vim and Neovim users who work exclusively with git and want per-hunk staging and undoing directly in the editor, without switching to a terminal. It is the wrong tool for projects that use SVN, Mercurial, or Perforce; use vim-signify instead. Before trusting the sign update delay, set updatetime=100 in your vimrc; the Vim default of 4000ms makes sign updates feel sluggish.

Frequently asked questions

How do I update signs faster in vim-gitgutter?

Set the Vim updatetime option to a lower value, such as 100 milliseconds, by adding set updatetime=100 to your vimrc. The default of 4000ms delays sign updates significantly. Note that updatetime also controls Vim's swap file write interval.

Can vim-gitgutter stage only part of a changed block?

Yes. The plugin supports partial hunk staging, which lets you select specific lines within a changed block in visual mode and stage only those lines. Full hunk staging is done with the <leader>hs mapping.

Does vim-gitgutter work in Neovim?

Yes. The README provides separate install commands for Neovim using ~/.config/nvim/pack/airblade/start/ as the plugin directory. Line number highlighting requires Neovim 0.3.2 or higher, and the unlimited sign count requires Neovim 0.4.0 or higher.

Official sources

  1. airblade/vim-gitgutter on GitHub
  2. Issues
  3. License: MIT
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/airblade-vim-gitgutter.svg)](https://hysenlabs.com/projects/airblade-vim-gitgutter)