Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save YourFriendCaspian/a81f9ff644b76e1037308a4d6a31bb36 to your computer and use it in GitHub Desktop.
Save YourFriendCaspian/a81f9ff644b76e1037308a4d6a31bb36 to your computer and use it in GitHub Desktop.
function prompt_wikimatze_precmd {
git-info
}
function prompt_wikimatze_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_wikimatze_precmd
# Use extended color pallete if available.
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
_prompt_mseri_colors=(
"%F{81}" # Turquoise
"%F{75}" # Pastel Cyan
"%F{215}" # Light Orange
"%F{166}" # Orange - not used
"%F{119}" # Pastel Limegreen
)
else
_prompt_mseri_colors=(
"%F{cyan}"
"%F{magenta}"
"%F{yellow}"
"%F{red}"
"%F{green}"
)
fi
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b'
zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b'
zstyle ':prezto:module:git:info:branch' format '%F{green}%b%f'
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b'
zstyle ':prezto:module:git:info:clean' format ' %F{green}✔%f'
zstyle ':prezto:module:git:info:dirty' format ' %F{red}✗%f'
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b'
zstyle ':prezto:module:git:info:keys' format \
'prompt' ' %F{green}(%f$(coalesce "%b" "%p" "%c")${git_info[rprompt]}%s%F{green})%f' \
'rprompt' '%A%B%S%C%D%U%u'
# Define prompts.
PROMPT="${_prompt_mseri_colors[3]}%n%f@${_prompt_mseri_colors[2]}%m%f ${_prompt_mseri_colors[5]}%~%f"'${(e)git_info[prompt]}'" » "
RPROMPT=''
}
prompt_wikimatze_setup "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment