Skip to content

Instantly share code, notes, and snippets.

@dralletje
Created July 28, 2020 17:41
Show Gist options
  • Select an option

  • Save dralletje/a8f4a5190db82d40ce30eccbd3f19f50 to your computer and use it in GitHub Desktop.

Select an option

Save dralletje/a8f4a5190db82d40ce30eccbd3f19f50 to your computer and use it in GitHub Desktop.
local ret_status="%(?:%{$fg_bold[white]%}λ:%{$fg_bold[red]%}λ)"
# local gitpwd=$(git rev-parse --show-toplevel)
local dim="\e[2m"
git_pwd() {
if [[ -n $(git rev-parse --show-toplevel 2> /dev/null) ]]; then
echo "$(git rev-parse --show-toplevel)"
else
echo ""
fi
}
better_pwd() {
local branch=$(current_branch)
if [[ -n "${branch}" ]]; then
echo $(pwd | sed -e "s,^$(git_pwd),.,")
else
echo $(pwd | sed -e "s,^$HOME,~,")
fi
}
git_prompt() {
local branch=$(current_branch)
if [[ -n "${branch}" ]]; then
echo "%{$fg_bold[green]%}$(basename $(git_pwd))${dim}:${branch}%{$reset_color%} "
else
echo ""
fi
}
PROMPT='
$(git_prompt)%{$fg_bold[cyan]%}$(better_pwd) ${ret_status} %{$reset_color%}%{$fg[white]%}'
# preexec () { echo -ne "$reset_color" }
my_preexec () { echo -ne "$reset_color" }
preexec_functions+=my_preexec
unsetopt PROMPT_SP
# ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[red]%}$(basename $(git_pwd) 2> /dev/null)${dim}:%{$fg[blue]%}"
# ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%} %{$fg[yellow]%}✗"
# ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment