Making It Yours
lazygit's defaults are a stranger's choices about panel widths, file trees, keystrokes and colours. This chapter moves the furniture: the configuration file, one verified change to it, the way to read the entire list of defaults, and the two deeper customisations — your own keybindings and custom commands — that this guide describes but does not prescribe. The outcome: you know where the settings live, how to change one thing safely, and how to discover every other thing that can be changed.
The configuration file
Ask lazygit where its settings live (the answer is an ordinary folder, and the command works on every system):
lazygit --print-config-dir
On the lab's Linux machine it printed
~/.config/lazygit; on macOS the
equivalent lives under
~/Library/Application Support, and on
Windows under the user's AppData. In
that folder sits config.yml — a
YAML file, empty on first run, waiting.
Everything you put in it overrides the
built-in default of the same name, and
nothing else changes: the file is a list
of exceptions, not a copy of the whole.
Two command-line relatives, from --help:
--use-config-dir starts lazygit with a
different configuration folder (for a
second persona, or a test), and
--use-config-file names specific files
to layer in. Most readers will never need
either; both are how you experiment
without endangering the setup you like.
One verified change
The Files panel's folder tree is chapter
5's friend, but if your repositories are
flat, the tree is a tax. The setting is
one of the defaults the lab changed and
watched change (transcript
lazygit-lab/transcripts/t10-config.txt).
Put these two lines in config.yml:
gui:
showFileTree: false
Start lazygit again, and the Files panel
lists its files flat — M
summer-walk.txt, A shopping.txt, ??
winter-walk.txt, no root row, sorted as
one list. Remove the lines, and the tree
returns. That round trip — one setting,
one visible difference, reversible by
deletion — is the pattern for every
experiment this chapter encourages:
small, named, and undoable by removing
the exception.
Reading the defaults: --config
The complete map of what can be changed is lazygit's own printout:
lazygit --config
It prints the entire default
configuration as YAML — hundreds of
lines, organised exactly as your file
may be: gui: (panel layout, including
the sidePanels list that chapter 2
matched against the screen; widths;
whether the command log shows), git:
(the pager it uses for diffs, how it
treats merges and the main branches it
assumes), keybinding: (every panel's
every key, by name), os: (the editor
and opener commands for your system),
refresher:, update:, notARepository:
and more. Nobody reads it cover to cover.
The way to use it is as a dictionary:
wonder whether a behaviour is
configurable, search the printout for
its name, copy the spelling into your
config.yml, change the value. The lab
read it this way to confirm the panel
layout is data, not destiny.
A gentle warning from the format itself: YAML is whitespace-sensitive, and a setting indented one space too far is a different setting that silently does nothing. Change one thing, restart, look. The program starts fast; let it.
Your own keybindings
Under keybinding: in the defaults,
every action in every panel has a name
and a current key, and your file can
move them: name the panel, name the
action, give it a new key. Vim refugees
can restore their h and l; everyone
else is better served by learning the
defaults the chapters taught, which are
also the keys in every piece of lazygit
writing on earth — including the ?
popup, which always reflects your
bindings, not the book's. Rebind with
that trade in mind: you are editing your
own help text too.
Custom commands
The deepest door, named here and
documented rather than taught: the
configuration can define custom
commands — your own keystrokes that run
shell commands or git invocations against
the repository, with the selected commit,
branch or file substituted into them, and
their output shown in the program. It is
how shops wire lazygit to their ticket
systems and test runners. The project's
documentation carries the syntax and a
compendium of examples; the lab defined
none, and criteria.md files the whole
subject as documented-only. The advice
that survives second-hand: earn a custom
command. A command you run weekly by
hand is a candidate; a command you ran
once is a souvenir in your config file
forever.
Themes, briefly
Colours, border styles and the nerd-font
icons that can replace the plain markers
are all gui: settings, and all a matter
of taste this guide will not litigate.
One functional note under the aesthetics:
the interface's information is never
carried by colour alone. The staged and
unstaged columns are letters, the arrows
are characters, the conflict fences are
text — which is why a chapter of plain
screen captures could teach the whole
program, and why your theme cannot hide
anything you need to know.