A fast, powerline-style zsh prompt that brings live, click-through GitHub status into your terminal — without ever blocking on the network.
The left side shows your local checkout; the right side is a concise "needs my attention" report for the whole repo. Every glyph is an OSC-8 hyperlink, so ⌘/Ctrl-clicking jumps straight to the relevant GitHub page.
Left prompt — your local checkout
- Abbreviated, clickable working directory (
~/P/E/my-repo, each segment opens its folder viafile://). - Open-in-IDE segment: a clickable glyph opens the project in IntelliJ
IDEA (when it carries a
.idea/config) and/or VS Code (in any git repo, when VS Code is installed). - Git state: branch name, staged / modified / untracked flags, ahead/behind counts — clean vs dirty background color.
- Ref kind glyph: plain branch, open PR, draft PR, or detached HEAD.
- Build status of HEAD (passed / failed / running / waiting-for-approval), deep-linked to the specific GitHub Actions run behind that status.
- Click targets: git glyph → repo, branch name → repo at that branch, ref glyph → the PR (or the commit when detached), build glyph → the run.
Right prompt — needs my attention (each item appears only when its count > 0)
- PRs requesting my review → the review-requested search.
- My open PRs, flagged when any are approved/ready or have changes requested → the matching author searches.
- Total open PRs in the repo → the pulls list.
- Plus the last command's duration (when slow) and a
HH:MMclock.
Under the hood
ghis queried in a background job; results are cached per repo+branch, so the prompt is always instant.- When fresh data lands, the prompt redraws itself via a
zle -Ffd watcher (fires only while the line editor is idle — never mid-render, so it can't corrupt the prompt the way a signal could). - Degrades gracefully: non-GitHub repos show just the local git state; missing
/ unauthenticated
ghsimply omits the GitHub bits.
- zsh
- git
gh, authenticated:gh auth login- A Nerd Font for the glyphs (e.g. JetBrainsMono Nerd Font). Set it in your terminal — and in your editor if you want to see the glyphs while editing this file.
git clone https://github.com/mkutz/zsh-github-powerline.git \
~/Projects/zsh-github-powerlineAdd to your ~/.zshrc:
source ~/Projects/zsh-github-powerline/zsh-github-powerline.plugin.zshzsh-github-powerline.plugin.zsh loads github.zsh from the same directory
automatically. Restart your shell (exec zsh).
# zinit
zinit light mkutz/zsh-github-powerline
# antidote (add to your plugins file)
mkutz/zsh-github-powerline
# oh-my-zsh
git clone https://github.com/mkutz/zsh-github-powerline.git \
"$ZSH_CUSTOM/plugins/zsh-github-powerline"
# then add `zsh-github-powerline` to plugins=(...)All settings are plain variables. The simplest approach is to edit them at the top of the two files; or set them after sourcing to override.
Glyphs (need a Nerd Font). In zsh-github-powerline.plugin.zsh: PL_SEP,
PL_FOLDER, PL_BRANCH, PL_STAGED, PL_MODIFIED, PL_UNTRACKED,
PL_AHEAD, PL_BEHIND, PL_CROSS, PL_IDE_VSCODE, PL_IDE_IDEA, PL_TIMER,
PL_CLOCK. In github.zsh:
PL_GH_REF_BRANCH/PR/DRAFT/DETACHED, PL_GH_BUILD_OK/FAIL/WIP/WAIT,
PL_GH_PR_ICON, and the attention icons PL_GH_REVIEW_ICON, PL_GH_MINE_ICON,
PL_GH_READY_ICON, PL_GH_CHANGES_ICON.
Some glyph variables ship empty — paste your preferred Nerd Font icons into them. Until you do, that item shows its count with no icon.
Colors (256-color codes): PL_EXIT_BG/FG, PL_DIR_BG/FG, PL_IDE_BG/FG,
PL_GIT_CLEAN_BG, PL_GIT_DIRTY_BG, PL_GIT_FG, PL_DUR_FG, PL_CLOCK_FG.
Behavior
| Variable | Default | Meaning |
|---|---|---|
PL_DEFAULT_BRANCHES |
main master |
branches whose name is hidden (glyph only) |
PL_HYPERLINKS |
1 |
OSC-8 click-through links (0 to disable) |
PL_IDE_LINKS |
1 |
show the open-in-IDE segment (IntelliJ when .idea/ present; VS Code in git repos) |
PL_HAVE_VSCODE |
auto | whether VS Code is installed (auto-detected); set 0/1 to override |
PL_CMD_MIN_SECONDS |
5 |
only show duration for commands at least this long |
PL_GH_TTL |
20 |
seconds before cached GitHub data is refreshed |
PL_GH_CACHE_DIR |
$XDG_CACHE_HOME/zsh-gh-prompt |
where cache files live |
- GitHub host is github.com only (GitHub Enterprise isn't detected yet).
- The open-in-IDE glyph relies on each IDE's URL handler. VS Code's
(
vscode://file/…) opens the folder reliably; since VS Code leaves no per-project marker on disk, its glyph appears in any git repo when VS Code is installed (toggle withPL_HAVE_VSCODE). IntelliJ has no URL to open a project by path (IDEA-65879 is shelved), so the glyph usesjetbrains://idea/navigate/reference?project=…— it focuses a project IntelliJ already knows by name and needs thejetbrains://handler that JetBrains Toolbox registers. - The "attention" data is repo-wide but cached per branch, so the first prompt on a freshly checked-out branch refetches it.
- Uses the GitHub search API for exact counts, which has a lower rate limit;
the
PL_GH_TTLcache keeps requests well within it.
Tests are offline and deterministic — no network or gh auth required:
zsh test/test.zsh # syntax, functions, remote parsing, rendering
zsh test/test-build-states.zsh # build states + attention report (stubbed gh)test-build-states.zsh replaces gh with a stub that feeds canned JSON through
the same --jq filters the code uses (via jq), then asserts both the cache
contents and the exact glyphs/links rendered for each state. CI runs both
suites plus zsh -n linting on Linux and macOS for every push and PR.
Apache-2.0 © Michael Kutz
