README.md

June 11, 2026 · View on GitHub

asciicast

a minimalist zsh prompt theme inspired by geometry, fast by design.

At a glance, you see what matters. Nothing else clutters your prompt.

  • Current branch, tag, or short commit SHA
  • Clean or dirty working tree
  • Commits ahead or behind upstream
  • Time since the last commit
  • Elapsed time on long-running commands
  • Background job count
  • Exit code of the previous command when it fails

Install

Add this to your ~/.zsh_plugins.txt:

dio-az/hexagon

zplug

Add this to your ~/.zshrc:

zplug "dio-az/hexagon"

Styling

Hexagon uses zstyle for configuration. The general format is:

zstyle ':hexagon:context' property value

For example, to change the path color to cyan:

zstyle ':hexagon:path' color cyan

Prompt path

The path on the left is yours to style:

ContextPropertyDefaultDescription
:hexagon:pathcolorblueLeft-prompt path color
:hexagon:pathformat%2~Left-prompt path format (zsh prompt expansion)

Components

Add, drop, or rearrange the right-prompt pieces:

ContextPropertyDefaultDescription
:hexagoncomponentstimer jobs gitRight-prompt components, in order

Timer

Slow commands quietly show how long they took:

ContextPropertyDefaultDescription
:hexagon:timerthreshold5Seconds a command must run before elapsed time is shown

Duration

Customize the color of the durations shown by git elapsed and timer:

ContextPropertyDefaultDescription
:hexagon:duration:daycolorredColor for day-scale durations
:hexagon:duration:hourcolorwhiteColor for hour-scale durations
:hexagon:duration:minutecolorgreenColor for minute-scale durations
:hexagon:duration:secondcolorgreenColor for second-scale durations

Jobs

See how many background jobs are running:

ContextPropertyDefaultDescription
:hexagon:jobscolorblueJob count color
:hexagon:jobssymbolSymbol rendered after the job count

Exit

When the previous command fails, see its exit code:

ContextPropertyDefaultDescription
:hexagon:exitcolorredExit code color
:hexagon:exitsymbolSymbol rendered before the exit code

Note

The exit component is not enabled by default. Add it to your components:

zstyle ':hexagon' components exit timer jobs git

The indicator is hidden for 0 (success), 130 (Ctrl-C), and 141 (SIGPIPE).

Git

Inside a repo, see your branch, working-tree state, and upstream tracking:

ContextPropertyDefaultDescription
:hexagon:gitcomponentsremote branch elapsed statusGit sub-components, in order
:hexagon:git:branchcolor242Branch, tag, or short SHA color
:hexagon:git:status:cleancolorgreenStatus indicator color when tree is clean
:hexagon:git:status:cleansymbolStatus symbol when tree is clean
:hexagon:git:status:dirtycolorredStatus indicator color when tree has changes
:hexagon:git:status:dirtysymbolStatus symbol when tree has changes
:hexagon:git:remotecolordefaultAhead/behind indicator color
:hexagon:git:remoteaheadSymbol shown when ahead of upstream
:hexagon:git:remotebehindSymbol shown when behind upstream
:hexagon:git:stashcolor242Stash count color
:hexagon:git:stashsymbolSymbol rendered after the stash count

Tip

The elapsed sub-component is styled via :hexagon:duration:*.

Note

The stash sub-component ships built-in but isn't enabled by default.

Custom components

A component is a shell function named hexagon_<name> that writes its output to stdout.

Tip

Return without printing anything to hide the component.

Register custom components by setting :hexagon components. This replaces the list, so include any built-ins you still want:

zstyle ':hexagon' components <name> timer jobs git

Tip

You can also redefine built-in components by giving your function the same name.

The following helper functions are available:

HelperDescription
hexagon::color <color> <text>Wrap text in a %F{color}text%f prompt escape
hexagon::escape <text>Neutralize prompt metacharacters (%, !, $, `, \)
hexagon::style -s <context> <property> <default>Read a scalar zstyle into $<property>, defaulting to <default>
hexagon::style -a <context> <property> <defaults...>Like -s, but for array styles
hexagon::duration <seconds>Format a duration label (5s, 3m), styled by :hexagon:duration:*

Important

Always run untrusted text through hexagon::escape before printing it, or it can hijack the prompt and run arbitrary commands.

Here is a component that shows the active major Node.js version:

hexagon_node() {
	command -v node &>/dev/null || return

	local color symbol
	hexagon::style -s ':hexagon:node' color green
	hexagon::style -s ':hexagon:node' symbol

	hexagon::color $color $symbol${${$(node --version)#v}%%.*}
}

zstyle ':hexagon' components node timer jobs git

Place this in your ~/.zshrc after loading Hexagon.

Git components

Like a regular component, but its function is named hexagon_git_<name>, registered under :hexagon:git components, and called only inside a git repository. Before it runs, the $hexagon_git associative array is populated with:

KeyDescription
hexagon_git[branch]Branch name; tag or 7-character SHA when detached
hexagon_git[sha]Full commit SHA of HEAD, or (initial) in a repo with no commits
hexagon_git[ahead]Commits ahead of upstream, or empty when there's no upstream
hexagon_git[behind]Commits behind upstream, or empty when there's no upstream
hexagon_git[dirty]1 when the working tree is dirty, otherwise empty
hexagon_git[commit_time]Unix timestamp of the most recent commit, or empty in a fresh repo
hexagon_git[stash]Number of stashes, or empty when none

Here is an override of the built-in remote that shows how many commits are ahead and behind upstream:

hexagon_git_remote() {
	(( hexagon_git[ahead] == 0 && hexagon_git[behind] == 0 )) && return

	local ahead behind color
	hexagon::style -s ':hexagon:git:remote' ahead
	hexagon::style -s ':hexagon:git:remote' behind
	hexagon::style -s ':hexagon:git:remote' color default

	(( hexagon_git[behind] == 0 )) && hexagon::color $color $hexagon_git[ahead]$ahead && return
	(( hexagon_git[ahead] == 0 )) && hexagon::color $color $hexagon_git[behind]$behind && return

	hexagon::color $color "$hexagon_git[ahead]$ahead $hexagon_git[behind]$behind"
}