mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Merge 7ac349baf8 into 5aed0aed4e
This commit is contained in:
commit
886379b131
2 changed files with 59 additions and 1 deletions
|
|
@ -1,3 +1,51 @@
|
||||||
|
## Source : https://bitbucket.org/Josh/mercurial-for-zsh
|
||||||
|
|
||||||
|
function prompt_hg_info(){
|
||||||
|
__CURRENT_DIR_IS_REPO=$(hg summary 2> /dev/null) || return
|
||||||
|
|
||||||
|
if [ -n "$__CURRENT_DIR_IS_REPO" ]; then
|
||||||
|
update_current_hg_vars
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$__CURRENT_HG_BRANCH" ]; then
|
||||||
|
local s="$__CURRENT_HG_BRANCH"
|
||||||
|
case "$__CURRENT_HG_BRANCH_STATUS" in
|
||||||
|
ahead)
|
||||||
|
d="↑"
|
||||||
|
;;
|
||||||
|
diverged)
|
||||||
|
d="↕"
|
||||||
|
;;
|
||||||
|
behind)
|
||||||
|
d="↓"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ -n "$__CURRENT_HG_BRANCH_IS_DIRTY" ]; then
|
||||||
|
d="⚡"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s[%s %s%s%s] " "%{${fg[yellow]}%}" $s "%{${fg[red]}%}" $d "%{${fg[yellow]}%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_current_hg_vars(){
|
||||||
|
unset __CURRENT_HG_BRANCH
|
||||||
|
unset __CURRENT_HG_BRANCH_STATUS
|
||||||
|
unset __CURRENT_HG_BRANCH_IS_DIRTY
|
||||||
|
local st="$(hg status 2>/dev/null)"
|
||||||
|
local br="$(hg branch 2>/dev/null)"
|
||||||
|
if [ -n "$br" ]; then
|
||||||
|
local -a arr
|
||||||
|
arr=(${(f)br})
|
||||||
|
export __CURRENT_HG_BRANCH="$(echo $arr[1])"
|
||||||
|
fi
|
||||||
|
if [ -n "$st" ]; then
|
||||||
|
if echo $st | grep "nothing to commit (working directory clean)" >/dev/null; then
|
||||||
|
else
|
||||||
|
export __CURRENT_HG_BRANCH_IS_DIRTY='1'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Mercurial
|
# Mercurial
|
||||||
alias hgc='hg commit'
|
alias hgc='hg commit'
|
||||||
|
|
@ -17,4 +65,4 @@ function hg_current_branch() {
|
||||||
if [ -d .hg ]; then
|
if [ -d .hg ]; then
|
||||||
echo hg:$(hg branch)
|
echo hg:$(hg branch)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
themes/educatux.zsh-theme
Normal file
10
themes/educatux.zsh-theme
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
PROMPT=$'
|
||||||
|
%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}$(prompt_hg_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%}
|
||||||
|
%{$fg_bold[black]%}>%{$reset_color%} '
|
||||||
|
|
||||||
|
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
Loading…
Add table
Add a link
Reference in a new issue