Skip to content

Making it yours

By the end of this chapter you know where Glow keeps its settings, what each of the five can do, and — the part worth the chapter — which of them Glow will quietly ignore, and where.

The file Glow writes for you

On its first run, Glow writes a configuration file, glow.yml, into your user configuration folder — on Linux, ~/.config/glow/ (or $XDG_CONFIG_HOME/glow/ when that variable is set; the lab pointed XDG_CONFIG_HOME at a scratch folder for every experiment in this guide, which is why its transcripts show lab paths). The file it writes, in full:

# style name or JSON path (default "auto")
style: "auto"
# mouse support (TUI-mode only)
mouse: false
# use pager to display markdown
pager: false
# word-wrap at width
width: 80
# show all files, including hidden and ignored.
all: false

Five settings, each met in its own chapter: style (8), width (9), pager (7), all (11), mouse (11). Note the file Glow generates is shorter than the example in the project's README, which shows extra keys (line numbers, preserving newlines) that the generated file does not contain; trust the file on your disk over the example.

glow config opens the file in your $EDITOR. The lab, with EDITOR set to cat, watched it print the file and then rewrite it — the command ends by writing the file back and reporting "Wrote config file to: …", so treat glow config as an edit, not a look (transcript glow-lab/transcripts/t07-config.txt).

Who wins: flags, file, and the pipe rule

The precedence the lab verified:

  • A flag beats the file. With the file set to style: "dark", a run with -s light rendered light — the body colour was light's 234, counted 594 times.
  • Width from the file is honoured everywhere — terminal and pipe alike: width: 60 in the file gave lines of 58 with no flag in sight.
  • Style from the file is honoured on a terminal and ignored in a pipe. With style: "dark" in the file and no flag, a piped run produced the 798-byte plain output, not the 9,212-byte dark one. This is chapter 6's pipe rule reaching into the configuration: into a pipe, only a flag can force colour; the file cannot.

The --config quirk, reported as found

Glow accepts --config <path> to name a different configuration file. The lab's finding is narrow and odd: glow config --config <path> edits the file at that path, as expected — but a rendering run with --config <path> ignored the width set inside it, even when the file was named glow.yml. The very same file, placed at the default location, was honoured (lines of 42 from width: 44, against 78 with --config). This is reported exactly as observed in version 3.0.0, on the lab's machine; it may be a defect, and it may not reproduce everywhere. The working rule is unaffected: keep your settings in the default file, or point XDG_CONFIG_HOME at the folder that holds them.

The environment's say

Three variables matter: PAGER (chapter 7) chooses the external pager; EDITOR chooses what glow config and the browser's e key open; XDG_CONFIG_HOME moves the configuration folder. And one conspicuous absence, repeated from chapter 6 because this is the chapter a reader will look in: NO_COLOR is not honoured. There is no Glow-specific style variable; the file and the flag are the whole story.

Check: set width: 60 in your glow.yml, render with no flags, and measure lines of 58. Set style: "dark", render on the terminal (coloured) and into a pipe (plain). If both behave as promised, the settings are yours.