Trying Out Vim Plugins (Series)

Part 3 - vim-gitgutter


Today’s plugin is vim-gitgutter.

vim-gitgutter

vim-gitgutter shows how your current file differs from the original version in your Git version control repository. Git is my preferred version control system (VCS) and I use it for this blog, so I look forwward to trying this plugin. Let’s give it a spin!

Configuration

Per recommendations from the plugin docs, I reduced the time between Vim’s updates significantly. The alternative was to wait four long seconds between refreshes. I did go with a less-frequent 300ms delay instead of the recommended 100ms, though, but I might adjust that later if I end up noticing the lag.

set updatetime=100

The plugin features a variety of customization options, more than I quite know what to do with, but the above setting was the only change I’ve made so far. I may tweak more as I get back into programming on this particular machine.

Usage

vim-gitgutter lets you use Vim’s folding functionality to collapse all of the unchanged lines in a file, allowing you to focus on only what changed. I expect to find this useful for reviewing large-scale changes to a file, such as a global search/replace.

The plugin’s ability to manage “hunks” (blocks of unchanged files) looks rather useful. One can use it to stage individual hunks (as opposed to staging every single change in a file), navigate between them, undo them, and more. I haven’t yet developed the habit of working in hunks but I admit that’s a better approach. Perhaps this plugin will push me in that more efficient direction.

I don’t have much Git-based work that I can use to test this plugin right now, aside from quick experiments with the posts in this series, but it does look promising. I may update this review after I have the chance. I hope you find it useful, though!

Previous Plugins

Upcoming Plugins