mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Added my own theme, with Mercurial repo status.
This commit is contained in:
parent
01b0366f3e
commit
4c58314c4b
2 changed files with 85 additions and 0 deletions
32
lib/hg.zsh
Normal file
32
lib/hg.zsh
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# 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}$(hg_prompt_status)$ZSH_THEME_HG_PROMPT_SUFFIX"
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
# get the status of the working tree
|
||||||
|
hg_prompt_status() {
|
||||||
|
INDEX=$(hg status 2> /dev/null)
|
||||||
|
STATUS=""
|
||||||
|
if $(echo "$INDEX" | grep '^? ' &> /dev/null); then
|
||||||
|
STATUS="$ZSH_THEME_HG_PROMPT_UNTRACKED$STATUS"
|
||||||
|
fi
|
||||||
|
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
|
||||||
|
STATUS="$ZSH_THEME_HG_PROMPT_ADDED$STATUS"
|
||||||
|
fi
|
||||||
|
if $(echo "$INDEX" | grep '^M ' &> /dev/null); then
|
||||||
|
STATUS="$ZSH_THEME_HG_PROMPT_MODIFIED$STATUS"
|
||||||
|
fi
|
||||||
|
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
|
||||||
|
STATUS="$ZSH_THEME_HG_PROMPT_DELETED$STATUS"
|
||||||
|
fi
|
||||||
|
echo $STATUS
|
||||||
|
}
|
||||||
53
themes/alex.zsh-theme
Normal file
53
themes/alex.zsh-theme
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
if [ $UID -eq 0 ]; then NCOLOUR="red"; else NCOLOUR="yellow"; fi
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[black]%}±"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="!"
|
||||||
|
ZSH_THEME_GIT_PROMPT_MODIFIED="!"
|
||||||
|
ZSH_THEME_GIT_PROMPT_ADDED="+"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="?"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
|
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[black]%}☿"
|
||||||
|
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_HG_PROMPT_DIRTY="!"
|
||||||
|
ZSH_THEME_HG_PROMPT_ADDED="+"
|
||||||
|
ZSH_THEME_HG_PROMPT_UNTRACKED="?"
|
||||||
|
ZSH_THEME_HG_PROMPT_CLEAN=""
|
||||||
|
|
||||||
|
EXIT_CODE_DISPLAY="%(?.%{$fg[green]%}.%{$fg[red]%}%? )"
|
||||||
|
ZSH_THEME_EXIT_CODE=$EXIT_CODE_DISPLAY
|
||||||
|
PROMPT_COLOUR=%{$fg[$NCOLOUR]%}
|
||||||
|
|
||||||
|
PROMPT='${PROMPT_COLOUR}%D{%k:%M} %c ➤ %{$reset_color%}'
|
||||||
|
RPROMPT='${ZSH_THEME_EXIT_CODE}$(git_prompt_info)$(hg_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
|
# See http://geoff.greer.fm/lscolors/
|
||||||
|
# ddllssppxxbbccuuggwwoo
|
||||||
|
export LSCOLORS=exgxfxfxcxegedabagaead
|
||||||
|
export LS_COLORS='di=34;40:ln=36;40:so=35;40:pi=35;40:ex=32;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;44:ow=0;43:'
|
||||||
|
|
||||||
|
unfunction precmd
|
||||||
|
unfunction preexec
|
||||||
|
|
||||||
|
function precmd {
|
||||||
|
settitle "%n@%m: %5(~:%-1~/.../%3~:%~)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function preexec {
|
||||||
|
settitle "%n@%m: %5(~:%-1~/.../%3~:%~) - $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function accept-line-and-enable-warning {
|
||||||
|
if [ -z "$BUFFER" ]; then
|
||||||
|
ZSH_THEME_EXIT_CODE=
|
||||||
|
PROMPT_COLOUR=%{$fg[$NCOLOUR]%}
|
||||||
|
else
|
||||||
|
ZSH_THEME_EXIT_CODE=$EXIT_CODE_DISPLAY
|
||||||
|
PROMPT_COLOUR="%(?.%{$fg[$NCOLOUR]%}.%{$fg[red]%})"
|
||||||
|
fi
|
||||||
|
zle accept-line
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N accept-line-and-enable-warning
|
||||||
|
bindkey '^M' accept-line-and-enable-warning
|
||||||
Loading…
Add table
Add a link
Reference in a new issue