Koh for zsh.

The Koh prompt shows where you are, what you have saved and whether anything is waiting. Tab completion keeps the commands and save IDs close at hand.

c-41

Install the plugin

01
Install the prompt and completions
$ curl -fsSL https://koh.asha.software/shell/install.sh | sh

The Koh installer offers this plugin too. This command installs it separately and adds one source line to your zsh configuration.

02
Open a new shell

Step into a Koh repository and the segment appears. Everywhere else, your prompt carries on as usual.

Read the prompt

SegmentMeaning
c-41This repository
v0.4.0The version declared by the project
· 41 savesIts place on the line
· 5.4 MBThe whole repository on disk
!Unsaved changes
⚑The save you are on has been flagged
→Red when the last command failed

Tab completion

Commands and options complete as you type. When a command needs a save, the last 30 appear with their messages. Pick the work you remember; Koh fills in the ID.

Settings and your own prompt

Settings

Set these before the source line in ~/.zshrc.

VariableDefaultWhat it controls
KOH_COLOR_DIR73The folder's colour (a 256-colour number)
KOH_COLOR_VERSION214The version's colour
KOH_COLOR_META245The counts, the size and the prompt character
KOH_COLOR_ALERT203!, ⚑, and a prompt character after a failure
KOH_SHOW_VERSIONtrueShow the version
KOH_SHOW_SAVEStrueShow the save count
KOH_SHOW_SIZEtrueShow the size
KOH_PROMPT_CHAR→The prompt character
KOH_BINkohThe binary the segment calls, if yours lives somewhere else
KOH_DEFAULT_PROMPTtrueSet to false to keep your own prompt

Keep your own prompt

Set KOH_DEFAULT_PROMPT=false, then place $(koh_prompt) wherever the Koh segment belongs. Starship and Powerlevel10k can use the plain-text koh_prompt_info:

[custom.koh]
command = "koh_prompt_info"
when = "test -f .koh"
shell = ["zsh"]