Skip to content

Instantly share code, notes, and snippets.

@Zidaan-Hayat
Created July 6, 2023 23:28
Show Gist options
  • Save Zidaan-Hayat/606a44124a6a1c80667f8b14e6306aca to your computer and use it in GitHub Desktop.
Save Zidaan-Hayat/606a44124a6a1c80667f8b14e6306aca to your computer and use it in GitHub Desktop.
A minor spin on the "pi" ZSH theme https://github.com/tobyjamesthomas/pi
PROMPT=' ${return_status} %{$fg[blue]%}$(get_pwd)%{$reset_color%} $(git_prompt_info)${prompt_suffix}'
local return_status="%(?:%{$fg_bold[green]%}π:%{$fg_bold[red]%}π)"
local prompt_suffix="%{$fg[magenta]%}%{$reset_color%}"
# by shashankmehta (https://github.com/shashankmehta)
function get_pwd(){
git_root=$PWD
while [[ $git_root != / && ! -e $git_root/.git ]]; do
git_root=$git_root:h
done
if [[ $git_root = / ]]; then
unset git_root
prompt_short_dir=%~
else
parent=${git_root%\/*}
prompt_short_dir=${PWD#$parent/}
fi
echo $prompt_short_dir
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment