If you use Lazygit as your terminal Git UI, you know how convenient it is for staging, committing, and managing branches.
I use it in Neovim (LazyVim already configures it).
Integrating a custom pager (Lazygit Custom Pagers Documentation) can dramatically improve how diffs are displayed.
In this blog post, I’ll document how to use delta: a syntax-highlighting pager for git, diff, and grep output.
Delta makes diffs much more readable by adding syntax highlighting, line numbers, and custom themes. This is especially helpful when reviewing changes in Lazygit, as it makes it easier to spot what’s changed at a glance.
Installing delta
On Arch Linux (or derivatives), you can install delta with:
1 |
sudo pacman -S git-delta |
For other platforms, check the delta installation instructions.
Configuring Lazygit to use delta
To use delta as the pager in Lazygit, add the following to your ~/.config/lazygit/config.yml
:
1 2 3 4 |
git: paging: colorArg: always pager: delta --paging=never |
This tells Lazygit to use delta for displaying diffs, with color always enabled and paging disabled (since Lazygit handles paging itself).
Here are two screenshots with the diffs better highlighted:
Show line numbers
If you want to see line numbers in your diffs, update the pager line with “–line-numbers”.
Customizing delta with themes
Delta supports custom themes for even better readability. You can find a collection of themes here.
To use these themes:
-
Download the raw
themes.gitconfig
file, for example, to~/.config/delta/themes.gitconfig
:1wget https://raw.githubusercontent.com/dandavison/delta/main/themes.gitconfig -O ~/.config/delta/themes.gitconfig -
Include it in your global Git config by adding the following to your
~/.gitconfig
:12[include]path = ~/.config/delta/themes.gitconfig - To see available themes, run:
1delta --show-themes
-
Pick a theme you like (e.g.,
colibri
) and enable it in your Lazygit config:1234git:paging:colorArg: alwayspager: delta --paging=never --line-numbers --features=colibri
For example, with the “colibri” theme:
With “weeping-willow” theme:
Enjoy your diffs! 🙂
this is actually helpful. thanks, sir! or my man I guess