Skip to content

Instantly share code, notes, and snippets.

@NorfeldtKnowit
Last active July 6, 2026 12:28
Show Gist options
  • Select an option

  • Save NorfeldtKnowit/f84c07be36d01bb5c1a80f8ce5696aae to your computer and use it in GitHub Desktop.

Select an option

Save NorfeldtKnowit/f84c07be36d01bb5c1a80f8ce5696aae to your computer and use it in GitHub Desktop.
AI Cookbook — Git + Lazygit with Delta (Tokyo Night)

AI Cookbook — Git + Lazygit with Delta (Tokyo Night)

This cookbook reproduces a clean, side-by-side diff setup themed in Tokyo Night, applied consistently in two places: the terminal (every git diff, git show, git log -p, and merge conflict) and lazygit's diff panes. It uses delta as the pager, with custom add/remove backgrounds, colored line-number gutters, and styled file and hunk headers, so reviews read the same way whether you are on the command line or driving lazygit.

Prerequisites

  • macOS with Homebrew.
  • A true-color (24-bit) terminal, since the theme relies on exact hex colors.
  • git and (optionally) lazygit already installed.

1. Install

brew install git-delta

Optional, only if you want to add custom syntax-highlighting themes for delta later:

brew install bat

Verified versions at the time of writing:

  • git-delta 0.19.2
  • bat 0.26.1

2. Global git config

The block below is what lands in ~/.gitconfig. The key groups are annotated:

  • syntax-theme picks the base code-coloring theme (TwoDark) that delta tints on top of.
  • The *-style add/remove pairs set the +/- line backgrounds, with the *-emph-* variants used for the changed words within a line.
  • The line-numbers-* keys color the left/right line-number gutters (green for added, red for removed, muted for context).
  • file-* and hunk-header-* keys style the file path banner and the hunk separators.
  • blame-palette is the four-stop background ramp used by delta --blame, ordered darkest to lightest.
[core]
    pager = delta

[interactive]
    diffFilter = delta --color-only

[merge]
    conflictstyle = zdiff3

[delta]
    navigate = true
    side-by-side = true
    line-numbers = true
    syntax-theme = TwoDark

    # +/- LINE BACKGROUNDS (TOKYO NIGHT)
    minus-style = syntax "#37222c"
    minus-emph-style = syntax "#713137"
    plus-style = syntax "#20303b"
    plus-emph-style = syntax "#2c5a47"
    zero-style = syntax

    # LINE-NUMBER GUTTERS
    line-numbers-minus-style = "#f7768e"
    line-numbers-plus-style = "#9ece6a"
    line-numbers-zero-style = "#737aa2"
    line-numbers-left-style = "#737aa2"
    line-numbers-right-style = "#737aa2"

    # FILE + HUNK HEADERS
    file-style = "#7aa2f7" bold
    file-decoration-style = "#3b4261" ul
    hunk-header-style = "#7dcfff" bold
    hunk-header-decoration-style = "#3b4261" box
    hunk-header-line-number-style = "#bb9af7"

    # BLAME PALETTE (DARKEST -> LIGHTEST)
    blame-palette = "#1a1b26" "#16161e" "#292e42" "#414868"

To apply the same configuration programmatically, run:

git config --global core.pager "delta"
git config --global interactive.diffFilter "delta --color-only"
git config --global merge.conflictstyle "zdiff3"

git config --global delta.navigate true
git config --global delta.side-by-side true
git config --global delta.line-numbers true
git config --global delta.syntax-theme "TwoDark"

git config --global delta.minus-style "syntax #37222c"
git config --global delta.minus-emph-style "syntax #713137"
git config --global delta.plus-style "syntax #20303b"
git config --global delta.plus-emph-style "syntax #2c5a47"
git config --global delta.zero-style "syntax"

git config --global delta.line-numbers-minus-style "#f7768e"
git config --global delta.line-numbers-plus-style "#9ece6a"
git config --global delta.line-numbers-zero-style "#737aa2"
git config --global delta.line-numbers-left-style "#737aa2"
git config --global delta.line-numbers-right-style "#737aa2"

git config --global delta.file-style "#7aa2f7 bold"
git config --global delta.file-decoration-style "#3b4261 ul"
git config --global delta.hunk-header-style "#7dcfff bold"
git config --global delta.hunk-header-decoration-style "#3b4261 box"
git config --global delta.hunk-header-line-number-style "#bb9af7"

git config --global delta.blame-palette "#1a1b26 #16161e #292e42 #414868"

3. Lazygit config

Find the config directory with lazygit --print-config-dir. On macOS the file lives at ~/Library/Application Support/lazygit/config.yml. Put this in it:

git:
  pagers:
    - colorArg: always
      pager: delta --paging=never --side-by-side --line-numbers

gui:
  # COLLAPSE UNFOCUSED LEFT PANES (BRANCHES ONLY GROWS WHEN FOCUSED)
  expandFocusedSidePanel: true
  theme:
    # READABLE SELECTION HIGHLIGHT (TOKYO NIGHT SELECTION BLUE + LIGHT TEXT)
    selectedLineBgColor:
      - "#2e3c64"
    selectedRangeBgColor:
      - "#2e3c64"
    activeBorderColor:
      - "#7aa2f7"
      - bold
    inactiveBorderColor:
      - "#737aa2"

A couple of notes on the choices:

  • gui.expandFocusedSidePanel: true keeps the unfocused left-hand panels compact and only expands the one you are currently in, so the diff view stays wide.
  • The theme colors mirror the terminal setup: a Tokyo Night selection blue (#2e3c64) for the highlighted line and range, the same accent blue (#7aa2f7) for the active pane border, and a muted blue-gray (#737aa2) for inactive borders, so focus is obvious without being loud.
  • delta --paging=never is important inside lazygit so delta renders the diff but hands paging back to lazygit's own scroller.

4. Apply

  • Relaunch lazygit so it re-reads config.yml.
  • In a terminal, run git diff (or git show) in any repo with changes; you should see the side-by-side Tokyo Night diff. Use n and N to navigate between files thanks to delta.navigate.

5. Live git log (viddy)

git log has no native --watch, and the obvious workaround (a while clear; git log; sleep 2 loop) flickers badly because it wipes and repaints the whole screen on every tick. viddy is a watch reimplemented in Rust that solves this with differential cell rendering: it only repaints the cells that actually changed, so the view stays steady, and its -d flag highlights whatever just changed. These two shell aliases (full file: shell-git-aliases.sh) give a static log and a live one.

Install viddy:

brew install viddy

Verified version at the time of writing:

  • viddy 1.3.1

Add these to ~/.zshrc:

alias log='git log --compact-summary --relative-date --graph'
alias logw='viddy -d -n 2 "git -c core.pager=cat log -n 200 --compact-summary --relative-date --graph --color=always"'
  • log is a compact, graphed history with relative dates, rendered through the delta pager from section 2.
  • logw watches that same log live, refreshing every 2 seconds (-n 2) with changed cells highlighted (-d). The -n 200 flag caps the output at 200 commits so git does bounded work on every refresh tick, while still giving viddy a deep enough buffer to scroll through.

Three gotchas the logw alias has to work around, the first two because the command runs inside viddy rather than directly in your shell:

  • Disable the pager (git -c core.pager=cat ..., or --no-pager). Otherwise git launches its pager and the command hangs under viddy instead of returning output.
  • Force --color=always. viddy's output is not a TTY, so git would strip color by default; making color unconditional keeps the graph and delta-style coloring visible.
  • Use git's own -n 200 rather than piping to | head -40. Piping to head truncates the captured output to 40 lines before viddy even sees it, so there is nothing deeper to scroll into. Letting git bound the commit count with -n 200 keeps the full 200-commit buffer intact and scrollable.

Notes / Tuning

A few readability knobs you can adjust to taste:

  • Context line-number color: delta.line-numbers-zero-style is #737aa2. For dimmer context numbers try #565f89, or for brighter ones #a9b1d6.
  • Selection background in lazygit: selectedLineBgColor / selectedRangeBgColor are #2e3c64. A subtler highlight is #283457; a stronger one is #3b4261.
  • Inactive border and tab color in lazygit: inactiveBorderColor is #737aa2. Drop it to #3b4261 for near-invisible borders, or raise it to #9aa5ce for more contrast.

Maintained automatically by an AI agent. Last verified: <date>.

[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[merge]
conflictstyle = zdiff3
[delta]
navigate = true
side-by-side = true
line-numbers = true
syntax-theme = TwoDark
# +/- LINE BACKGROUNDS (TOKYO NIGHT)
minus-style = syntax "#37222c"
minus-emph-style = syntax "#713137"
plus-style = syntax "#20303b"
plus-emph-style = syntax "#2c5a47"
zero-style = syntax
# LINE-NUMBER GUTTERS
line-numbers-minus-style = "#f7768e"
line-numbers-plus-style = "#9ece6a"
line-numbers-zero-style = "#737aa2"
line-numbers-left-style = "#737aa2"
line-numbers-right-style = "#737aa2"
# FILE + HUNK HEADERS
file-style = "#7aa2f7" bold
file-decoration-style = "#3b4261" ul
hunk-header-style = "#7dcfff" bold
hunk-header-decoration-style = "#3b4261" box
hunk-header-line-number-style = "#bb9af7"
# BLAME PALETTE (DARKEST -> LIGHTEST)
blame-palette = "#1a1b26" "#16161e" "#292e42" "#414868"
git:
pagers:
- colorArg: always
pager: delta --paging=never --side-by-side --line-numbers
log:
# ALWAYS DRAW THE COMMIT GRAPH; KEEP TOPOLOGICAL ORDER
showGraph: always
order: topo-order
# RENDER THE WHOLE CROSS-BRANCH GRAPH IN THE [4] COMMITS PANEL (LIKE `git log --all`)
# SO BRANCH DECORATIONS SHOW WHICH BRANCH EACH COMMIT IS ON WITHOUT SWITCHING VIEWS
showWholeGraph: true
# GIT-GRAPH-STYLE ALL-BRANCHES VIEW (PRESS `a` IN THE STATUS [1] PANEL; `a` AGAIN CYCLES)
allBranchesLogCmds:
# BRANCH/TAG LABELS (%d) FIRST SO THEY STAY VISIBLE AT 1/3 PANEL WIDTH, THEN HASH + SUBJECT + DATE + AUTHOR
- "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=format:'%C(auto)%d%C(reset) %C(yellow)%h%C(reset) %s %C(cyan)(%ad) %C(green)%an%C(reset)'"
# VERBOSE: SAME STYLE AS THE `log` SHELL ALIAS (FILE-CHANGE SUMMARY PER COMMIT)
- "git log --graph --all --color=always --decorate --date=relative --compact-summary"
gui:
# COLLAPSE UNFOCUSED LEFT PANES (BRANCHES ONLY GROWS WHEN FOCUSED)
expandFocusedSidePanel: true
theme:
# READABLE SELECTION HIGHLIGHT (TOKYO NIGHT SELECTION BLUE + LIGHT TEXT)
selectedLineBgColor:
- "#2e3c64"
selectedRangeBgColor:
- "#2e3c64"
activeBorderColor:
- "#7aa2f7"
- bold
inactiveBorderColor:
- "#737aa2"
# Git log shell aliases (add to ~/.zshrc)
#
# log - a compact, graphed git log with relative dates. Pairs with the delta
# pager from this cookbook for colored output in a normal terminal.
#
# logw - a live, flicker-free watcher of the same log, refreshed every 2s via
# viddy (`brew install viddy`). viddy uses differential cell rendering so
# only changed cells repaint (no full-screen wipe), and `-d` highlights
# the cells that just changed. Two things are mandatory under viddy:
# * core.pager=cat (or --no-pager) so git does not block on its pager
# * --color=always because output is not a TTY, so git strips color
# otherwise.
alias log='git log --compact-summary --relative-date --graph'
alias logw='viddy -d -n 2 "git -c core.pager=cat log -n 200 --compact-summary --relative-date --graph --color=always"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment