Last active
January 14, 2026 16:18
-
-
Save nickcernis/7a6ec18761a34690484cb5f6cec96dac to your computer and use it in GitHub Desktop.
Fast lightweight zsh prompt — just folder and git branch, no fancy plugins needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Gives this prompt if in git root: | |
| # | |
| # folder-name on branch | |
| # ❯ | |
| # | |
| # Or this if no git root: | |
| # | |
| # folder-name | |
| # ❯ | |
| # Add line break before prompt | |
| precmd() { print "" } | |
| # Fast git branch detection | |
| git_branch() { | |
| local branch | |
| if [[ -f .git/HEAD ]]; then | |
| read branch < .git/HEAD | |
| branch=${branch#ref: refs/heads/} | |
| echo " %F{white}on%f %B%F{magenta}$branch%f%b" | |
| fi | |
| } | |
| # Styled prompt | |
| setopt PROMPT_SUBST | |
| PROMPT='%B%F{cyan}%1~%f%b$(git_branch) | |
| %F{green}❯%f ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment