mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Merge 9500d67708 into d05b2010ff
This commit is contained in:
commit
6698e72cef
1 changed files with 22 additions and 0 deletions
|
|
@ -12,3 +12,25 @@ alias hgp='hg push'
|
||||||
alias hgs='hg status'
|
alias hgs='hg status'
|
||||||
# this is the 'git commit --amend' equivalent
|
# this is the 'git commit --amend' equivalent
|
||||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||||
|
|
||||||
|
# Theme vars and functions
|
||||||
|
ZSH_THEME_HG_PROMPT_PREFIX="hg:(" # Prefix at the very beginning of the prompt, before the branch name
|
||||||
|
ZSH_THEME_HG_PROMPT_SUFFIX=")" # At the very end of the prompt
|
||||||
|
ZSH_THEME_HG_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
||||||
|
ZSH_THEME_HG_PROMPT_CLEAN="" # Text to display if the branch is clean
|
||||||
|
|
||||||
|
# get the name of the branch we are on
|
||||||
|
function hg_prompt_info() {
|
||||||
|
ref=$(hg branch 2> /dev/null) || return
|
||||||
|
echo "$ZSH_THEME_HG_PROMPT_PREFIX${ref}$(parse_hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Checks if working tree is dirty
|
||||||
|
parse_hg_dirty() {
|
||||||
|
if [[ -n $(hg status 2> /dev/null) ]]; then
|
||||||
|
echo "$ZSH_THEME_HG_PROMPT_DIRTY"
|
||||||
|
else
|
||||||
|
echo "$ZSH_THEME_HG_PROMPT_CLEAN"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue