← Back to articles

Vim plugin: GitGutter

Are you used to separating your Vim and Git workflows? 🤔

As a software engineer, you probably work extensively with both a code editor and a version control system. Here, we’ll talk about a Vim plugin that provides Git integration inside your favorite editor. Introducing Gitgutter.

Lines Status Indicator

The first thing you’ll notice when starting Vim with Gitgutter is the appearance of a new column on the left side of your file content. This is the gutter!

In this column, you’ll see symbols indicating lines that have been modified and their status:

A Vim buffer with GitGutter signs on the left, showing added, removed, and modified lines

Hunk Navigation

A modified file usually consists of multiple hunks, a term derived from the original patch and diff commands in early UNIX. Each hunk is a group of closely related changed lines.

In Gitgutter, you can navigate between hunks using ]c (next hunk) and [c (previous hunk).

Stage Changes

Finally, Gitgutter allows you to stage hunks by using <Leader>hs. The Leader key depends on the mapleader variable in your configuration. If your Leader is set to ,, you’d press ,hs to stage the current hunk.

When dealing with an addition hunk, you can also choose exactly which lines to add by visually selecting them (press V in normal mode) and then running <Leader>hs.


While this is now a standard feature in most IDEs, I only discovered it a few years ago — thanks to a friend — and it’s been a game-changer ever since. If you haven’t tried it yet, you definitely should!