mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Merge 7a416b87d5 into caa15548c1
This commit is contained in:
commit
46a0c0a24b
5 changed files with 96 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,3 +6,4 @@ custom/*
|
|||
!custom/example.zsh
|
||||
cache
|
||||
*.swp
|
||||
.DS_Store
|
||||
|
|
|
|||
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
|
||||
}
|
||||
|
|
@ -9,5 +9,5 @@ bindkey "^[m" copy-prev-shell-word
|
|||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export PAGER=less
|
||||
export LC_CTYPE=$LANG
|
||||
export PAGER='less -MR'
|
||||
export LC_CTYPE=en_US.UTF-8
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
|||
if [ "$DISABLE_LS_COLORS" != "true" ]
|
||||
then
|
||||
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=auto -A' || alias ls='ls -G -A'
|
||||
fi
|
||||
|
||||
#setopt no_beep
|
||||
|
|
|
|||
60
themes/alex.zsh-theme
Normal file
60
themes/alex.zsh-theme
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
if [ $UID -eq 0 ]; then NCOLOUR="red"; else NCOLOUR="yellow"; fi
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}±"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[red]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[red]%}+"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[red]%}%"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}x"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}?"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}*"
|
||||
|
||||
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[white]%}☿"
|
||||
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_HG_PROMPT_MODIFIED="%{$fg[red]%}!"
|
||||
ZSH_THEME_HG_PROMPT_ADDED="%{$fg[red]%}+"
|
||||
ZSH_THEME_HG_PROMPT_UNTRACKED="%{$fg[red]%}?"
|
||||
ZSH_THEME_HG_PROMPT_DELETED="%{$fg[red]%}x"
|
||||
ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[red]%}!"
|
||||
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='%{$fg[grey]%}${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:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42: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
|
||||
# The accept-line-and-enable-warning feature breaks
|
||||
# when defining functions on the command line.
|
||||
# bindkey '^M' accept-line-and-enable-warning
|
||||
Loading…
Add table
Add a link
Reference in a new issue