powerline-go
A beautiful and useful low-latency prompt for your shell, written in go
What is powerline-go?
A beautiful and useful low-latency prompt for your shell, written in go
Overview of powerline-go
What it is
powerline-go is a low-latency prompt for Bash, ZSH, Fish, and PowerShell shells, written in Go. It is based on Powerline-Shell by @banga and ported to Go by @justjanne. It uses ANSI color codes and requires a powerline font (or compatible/flat mode) for the default patched UI. The project is hosted on GitHub under the GPL-3.0 license.
Key features
- Displays git/hg branch details, including dirty state, commit differences (push/pull indicators), and symbols for modified, staged, conflicted, untracked files, and stashes.
- Changes prompt color if the last command exited with a non-zero error code.
- Shortens the displayed directory path with an ellipsis when the directory tree is deep.
- Shows the current Python virtualenv environment.
- Shows the current Ruby version using rbenv or rvm.
- Indicates if the user is inside a nix shell.
- Supports customization via command-line flags (e.g.,
-cwd-mode,-git-mode,-colorize-hostname,-duration).
Use cases
- Developers who want a visually informative shell prompt that shows version control status, error codes, and environment details at a glance.
- Users working with multiple shells (Bash, ZSH, Fish, PowerShell) who want a consistent prompt across them.
- Users who need a low-latency prompt that can handle large git repositories (with options to disable certain git stats for performance).
- Users in nix-shell environments who need a workaround to keep the prompt visible.
Getting started
Install with Go (requires Go 1.15+): bash go install github.com/justjanne/powerline-go@latest For Bash, add to .bashrc: bash function _update_ps1() { PS1='$($GOPATH/bin/powerline-go -error $? -jobs $(jobs -p | wc -l))' } if [ '$TERM' != 'linux' ] && [ -f '$GOPATH/bin/powerline-go' ]; then PROMPT_COMMAND='_update_ps1; $PROMPT_COMMAND' fi For ZSH, add to .zshrc: bash function powerline_precmd() { PS1='$($GOPATH/bin/powerline-go -error $? -jobs ${${(%):%j}:-0})' } function install_powerline_precmd() { for s in '${precmd_functions[@]}'; do if [ '$s' = 'powerline_precmd' ]; then return fi done precmd_functions+=(powerline_precmd) } if [ '$TERM' != 'linux' ] && [ -f '$GOPATH/bin/powerline-go' ]; then install_powerline_precmd fi For Fish, add to ~/.config/fish/config.fish: bash function fish_prompt eval $GOPATH/bin/powerline-go -error $status -jobs (count (jobs -p)) end For PowerShell, redefine the prompt function in your profile (see repository README for full example).
License and pricing
The project is licensed under GPL-3.0. It is open source and free to use. No pricing information is stated beyond the license.
Based on the project's public README and repository metadata.