2018-04-15 21:48:31 +08:00
|
|
|
# user, host, full path, and time/date on two lines for easier vgrepping
|
|
|
|
|
2011-09-20 16:16:51 +08:00
|
|
|
function hg_prompt_info {
|
2018-04-20 05:32:53 +08:00
|
|
|
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
|
2011-09-20 16:16:51 +08:00
|
|
|
hg prompt --angle-brackets "\
|
2014-12-10 20:40:34 +08:00
|
|
|
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
|
2011-09-20 16:16:51 +08:00
|
|
|
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
|
|
|
|
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
|
|
|
|
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
|
2018-04-20 05:32:53 +08:00
|
|
|
fi
|
2011-09-20 16:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"
|
|
|
|
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱"
|
|
|
|
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗"
|
|
|
|
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦"
|
|
|
|
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂"
|
2015-02-15 02:34:22 +08:00
|
|
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}✈"
|
|
|
|
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[blue]%}"
|
2014-04-19 09:04:58 +08:00
|
|
|
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
|
2011-09-20 16:16:51 +08:00
|
|
|
|
|
|
|
function mygit() {
|
2014-04-19 09:04:58 +08:00
|
|
|
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
|
|
|
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
|
|
|
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
2017-05-03 18:06:07 +08:00
|
|
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$(git_prompt_status)%{$fg_bold[blue]%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
|
2014-04-19 09:04:58 +08:00
|
|
|
fi
|
2011-09-20 16:16:51 +08:00
|
|
|
}
|
|
|
|
|
2013-04-24 21:50:48 +08:00
|
|
|
function retcode() {}
|
|
|
|
|
2011-09-20 16:16:51 +08:00
|
|
|
# alternate prompt with git & hg
|
2022-01-28 05:00:50 +08:00
|
|
|
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[default]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
|
2017-05-03 18:06:07 +08:00
|
|
|
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} '
|
2011-09-20 16:16:51 +08:00
|
|
|
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
|