Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment variables

Environment variables can be referenced using $XXX syntax, where XXX represents the name of the environment variable. For example:

  • $PATH - References the PATH environment variable
  • $HOME - References the HOME environment variable
  • $USER - References the current user’s username

This syntax is commonly used in shell scripts and configuration files to access system-level environment variables.

Sandboxing

$VAR/${$VAR} references (and debugger logpoints that read an env var) are disabled by default, matching --allow-read/--allow-write/--allow-net/--allow-run. Pass --allow-env to allow reading any environment variable, or --allow-env=NAME (repeat the flag, or comma-separate, to add more) to restrict access to just those names:

# Allow any $VAR reference
mq --allow-env '$HOME' README.md

# Allow only $HOME
mq --allow-env=HOME '$HOME' README.md

--allow-all grants --allow-read/--allow-write/--allow-net/--allow-run/--allow-env all at once, including $VAR access.

Color Configuration

NO_COLOR

When set to a non-empty value, disables all colored output regardless of the -C flag. This follows the NO_COLOR standard.

# Disable colored output
NO_COLOR=1 mq -C '.h' README.md

MQ_COLORS

Customizes the colors used when -C (color output) is enabled. The format is a colon-separated list of key=value pairs, where each value is a semicolon-separated list of SGR (Select Graphic Rendition) parameters.

# Make headings bold red, code blocks blue
export MQ_COLORS="heading=1;31:code=34"
mq -C '.h' README.md

Only the specified keys are overridden; unspecified keys use the default colors. Invalid entries are silently ignored.

Available Keys

KeyDescriptionDefault
headingHeadings (#, ##, etc.)bold cyan (1;36)
codeFenced code blocksgreen (32)
code_inlineInline codegreen (32)
emphasisItalic text (*text*)italic yellow (3;33)
strongBold text (**text**)bold (1)
linkLinks ([text](url))underline blue (4;34)
link_urlLink URLsblue (34)
imageImages (![alt](url))magenta (35)
blockquoteBlockquote markers (>)dim (2)
deleteStrikethrough (~~text~~)red dim (31;2)
hrHorizontal rules (---)dim (2)
htmlInline HTMLdim (2)
frontmatterYAML/TOML frontmatterdim (2)
listList markers (-, *, 1.)yellow (33)
tableTable separatorsdim (2)
mathMath expressions ($...$)green (32)

Common SGR Codes

CodeEffect
0Reset
1Bold
2Dim
3Italic
4Underline
31Red
32Green
33Yellow
34Blue
35Magenta
36Cyan
37White

REPL Configuration

MQ_REPL_OUTPUT_LIMIT

Sets how many lines of a result the REPL prints at once. Longer results are cut off with a hint, and the rest can be shown with the /more and /all commands. The default is 50.

ValueBehavior
unsetPrint 50 lines at a time
a positive integer (e.g. 100)Print that many lines at a time
0Never truncate, print everything
anything elseFall back to the default (50)
# Print 20 lines at a time
MQ_REPL_OUTPUT_LIMIT=20 mq repl README.md
❯ .code
...
... 73 more lines (/more: next 20, /all: show all)
❯ /more
...
❯ /all
...

The variable is read on every evaluation, so it can also be changed inside the REPL with /env:

❯ /env MQ_REPL_OUTPUT_LIMIT 100
CommandDescription
/moreShow the next page of truncated output
/allShow all remaining truncated output, regardless of the limit