Skip to main content
Glow supports various command-line flags to customize rendering behavior, output format, and TUI functionality.

Global Flags

—config

Specify a custom configuration file path.
--config
string
default:"auto-detected"
Path to a custom glow config file. When not specified, Glow searches for config files in standard locations.
Example:
glow --config ~/.config/glow/custom.yml README.md
Source: main.go:397

Rendering Flags

—pager / -p

Display rendered markdown using a pager.
--pager
boolean
default:"false"
When enabled, Glow pipes the rendered output to your system pager (defined by the PAGER environment variable, defaults to less -r).
Example:
glow -p long-document.md
Cannot be used simultaneously with --tui. The pager flag is mutually exclusive with TUI mode.
Source: main.go:398, main.go:316-329

—tui / -t

Display the rendered content in TUI (Text User Interface) mode.
--tui
boolean
default:"false"
Forces TUI mode even when a file is specified. Useful for viewing a specific file in the interactive interface.
Example:
glow -t README.md
Source: main.go:399

—style / -s

Specify the rendering style.
--style
string
default:"auto"
Style name (e.g., dark, light, notty) or path to a custom JSON style file. When set to auto, Glow automatically selects an appropriate style based on your terminal’s color scheme.
Built-in styles:
  • auto - Automatically detect terminal background
  • dark - Optimized for dark backgrounds
  • light - Optimized for light backgrounds
  • notty - Plain output for non-terminal environments
  • Custom JSON file path for advanced styling
Examples:
# Use dark style
glow -s dark README.md

# Use custom style
glow -s ~/.config/glow/mystyle.json README.md
Source: main.go:400

—width / -w

Set the word-wrap width.
--width
uint
default:"0"
Maximum line width for word-wrapping. When set to 0, Glow automatically detects terminal width (capped at 120 characters for readability). For non-terminal output, defaults to 80.
Examples:
# Wrap at 100 characters
glow -w 100 README.md

# Disable wrapping (full terminal width)
glow -w 0 README.md
Source: main.go:401, main.go:193-207

—preserve-new-lines / -n

Preserve newlines in the rendered output.
--preserve-new-lines
boolean
default:"false"
When enabled, Glow preserves newlines as they appear in the source markdown instead of reflowing text.
Example:
glow -n document.md
Source: main.go:404

TUI-Only Flags

The following flags only affect behavior when Glow is running in TUI mode.

—all / -a

Show system files and directories.
--all
boolean
default:"false"
Show hidden files, dot files, and system files in the TUI file browser. This flag only affects TUI mode.
Example:
glow -a ~/projects
This flag only works in TUI mode. It has no effect when rendering files directly to stdout.
Source: main.go:402

—line-numbers / -l

Display line numbers in the TUI.
--line-numbers
boolean
default:"false"
Enable line numbers when viewing files in TUI mode. This flag only affects TUI mode.
Example:
glow -l ~/docs
Source: main.go:403

—mouse / -m

Enable mouse wheel support.
--mouse
boolean
default:"false"
Enable mouse wheel scrolling in TUI mode. This is a hidden flag and only affects TUI mode.
Example:
glow -m
This is a hidden flag primarily for testing and advanced use. Mouse support may vary depending on your terminal emulator.
Source: main.go:405-406

Flag Combinations

Common Patterns

# Read from stdin with custom width and style
cat README.md | glow -w 120 -s dark

# TUI with all files visible and line numbers
glow -a -l ~/documents

# Pager mode with custom width
glow -p -w 100 large-file.md

# Custom config with specific style
glow --config ~/.glow.yml -s light doc.md

Mutually Exclusive Flags

The --pager and --tui flags cannot be used together. Glow will return an error if both are specified.
Source: main.go:175-177

Configuration File vs Flags

Flags specified on the command line take precedence over settings in the configuration file. This allows you to override config file defaults on a per-invocation basis. Priority order:
  1. Command-line flags (highest priority)
  2. Configuration file settings
  3. Built-in defaults (lowest priority)
Source: main.go:166-173, main.go:409-417

Auto-Detection Behavior

Style Auto-Detection

When --style is not specified or set to auto, Glow detects the terminal environment:
  • Terminal output: Automatically matches your terminal’s color profile
  • Non-terminal output (pipes, redirects): Uses the notty style for plain text
Source: main.go:186-190

Width Auto-Detection

When --width is not specified or set to 0:
  • Terminal output: Detects terminal width, capped at 120 characters
  • Non-terminal output: Defaults to 80 characters
Source: main.go:193-207

Build docs developers (and LLMs) love