Created
January 28, 2025 20:33
-
-
Save omarish/37db83401d14dc2d65824a1344be6c23 to your computer and use it in GitHub Desktop.
Fast and clean ZSH theme
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
# Allow command substitution in the prompt | |
setopt prompt_subst | |
# Helper function: Show Git branch info as ":branch" (± if dirty) | |
function prompt_git_info() { | |
if git rev-parse --is-inside-work-tree &>/dev/null; then | |
local branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" | |
# Check for uncommitted changes | |
if ! git diff --quiet --ignore-submodules HEAD &>/dev/null; then | |
# Dirty repo: append ± | |
echo "%F{yellow}:$branch±%f" | |
else | |
echo "%F{yellow}:$branch%f" | |
fi | |
fi | |
} | |
# Prompt components: | |
# - Red ✘ if last exit code is nonzero | |
# - username@hostname (omit username if it's omar; dim @ symbol) | |
# - Current directory (in blue) | |
# - Git info as ":branch" or ":branch±" if dirty (in yellow) | |
# - Default prompt symbol (% or #) | |
PROMPT='%(?..%F{red}✘%f )%n%F{250}@%f%m %F{blue}%~%f$(prompt_git_info) %# ' | |
export LSCOLORS="ExFxBxDxCxegedabagacad" | |
export COLORTERM=truecolor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment