mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
f8d469a88b
477 changed files with 16221 additions and 10340 deletions
|
|
@ -5,10 +5,10 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}"
|
|||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
|
||||
|
||||
# Text to display if the branch is dirty
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
|
||||
|
||||
# Text to display if the branch is clean
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
# Colors vary depending on time lapsed.
|
||||
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
|
||||
|
|
@ -36,7 +36,7 @@ function rvm_gemset() {
|
|||
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
|
||||
if [[ -n $GEMSET ]]; then
|
||||
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -52,12 +52,12 @@ function git_time_since_commit() {
|
|||
# Totals
|
||||
MINUTES=$((seconds_since_last_commit / 60))
|
||||
HOURS=$((seconds_since_last_commit/3600))
|
||||
|
||||
|
||||
# Sub-hours and sub-minutes
|
||||
DAYS=$((seconds_since_last_commit / 86400))
|
||||
SUB_HOURS=$((HOURS % 24))
|
||||
SUB_MINUTES=$((MINUTES % 60))
|
||||
|
||||
|
||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
||||
if [ "$MINUTES" -gt 30 ]; then
|
||||
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ ps1_command_tip() {
|
|||
command wget -qO- https://www.commandlinefu.com/commands/random/plaintext
|
||||
elif (( ${+commands[curl]} )); then
|
||||
command curl -fsL https://www.commandlinefu.com/commands/random/plaintext
|
||||
fi
|
||||
fi
|
||||
} | sed '1d;/^$/d'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ function afmagic_dashes {
|
|||
# the prompt, account for it when returning the number of dashes
|
||||
if [[ -n "$python_env" && "$PS1" = *\(${python_env}\)* ]]; then
|
||||
echo $(( COLUMNS - ${#python_env} - 3 ))
|
||||
elif [[ -n "$VIRTUAL_ENV_PROMPT" && "$PS1" = *${VIRTUAL_ENV_PROMPT}* ]]; then
|
||||
echo $(( COLUMNS - ${#VIRTUAL_ENV_PROMPT} - 3 ))
|
||||
else
|
||||
echo $COLUMNS
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -35,10 +35,74 @@
|
|||
CURRENT_BG='NONE'
|
||||
|
||||
case ${SOLARIZED_THEME:-dark} in
|
||||
light) CURRENT_FG='white';;
|
||||
*) CURRENT_FG='black';;
|
||||
light)
|
||||
CURRENT_FG=${CURRENT_FG:-'white'}
|
||||
CURRENT_DEFAULT_FG=${CURRENT_DEFAULT_FG:-'white'}
|
||||
;;
|
||||
*)
|
||||
CURRENT_FG=${CURRENT_FG:-'black'}
|
||||
CURRENT_DEFAULT_FG=${CURRENT_DEFAULT_FG:-'default'}
|
||||
;;
|
||||
esac
|
||||
|
||||
### Theme Configuration Initialization
|
||||
#
|
||||
# Override these settings in your ~/.zshrc
|
||||
|
||||
# Current working directory
|
||||
: ${AGNOSTER_DIR_FG:=${CURRENT_FG}}
|
||||
: ${AGNOSTER_DIR_BG:=blue}
|
||||
|
||||
# user@host
|
||||
: ${AGNOSTER_CONTEXT_FG:=${CURRENT_DEFAULT_FG}}
|
||||
: ${AGNOSTER_CONTEXT_BG:=black}
|
||||
|
||||
# Git related
|
||||
: ${AGNOSTER_GIT_CLEAN_FG:=${CURRENT_FG}}
|
||||
: ${AGNOSTER_GIT_CLEAN_BG:=green}
|
||||
: ${AGNOSTER_GIT_DIRTY_FG:=black}
|
||||
: ${AGNOSTER_GIT_DIRTY_BG:=yellow}
|
||||
|
||||
# Bazaar related
|
||||
: ${AGNOSTER_BZR_CLEAN_FG:=${CURRENT_FG}}
|
||||
: ${AGNOSTER_BZR_CLEAN_BG:=green}
|
||||
: ${AGNOSTER_BZR_DIRTY_FG:=black}
|
||||
: ${AGNOSTER_BZR_DIRTY_BG:=yellow}
|
||||
|
||||
# Mercurial related
|
||||
: ${AGNOSTER_HG_NEWFILE_FG:=white}
|
||||
: ${AGNOSTER_HG_NEWFILE_BG:=red}
|
||||
: ${AGNOSTER_HG_CHANGED_FG:=black}
|
||||
: ${AGNOSTER_HG_CHANGED_BG:=yellow}
|
||||
: ${AGNOSTER_HG_CLEAN_FG:=${CURRENT_FG}}
|
||||
: ${AGNOSTER_HG_CLEAN_BG:=green}
|
||||
|
||||
# VirtualEnv colors
|
||||
: ${AGNOSTER_VENV_FG:=black}
|
||||
: ${AGNOSTER_VENV_BG:=blue}
|
||||
|
||||
# AWS Profile colors
|
||||
: ${AGNOSTER_AWS_PROD_FG:=yellow}
|
||||
: ${AGNOSTER_AWS_PROD_BG:=red}
|
||||
: ${AGNOSTER_AWS_FG:=black}
|
||||
: ${AGNOSTER_AWS_BG:=green}
|
||||
|
||||
# Status symbols
|
||||
: ${AGNOSTER_STATUS_RETVAL_FG:=red}
|
||||
: ${AGNOSTER_STATUS_ROOT_FG:=yellow}
|
||||
: ${AGNOSTER_STATUS_JOB_FG:=cyan}
|
||||
: ${AGNOSTER_STATUS_FG:=${CURRENT_DEFAULT_FG}}
|
||||
: ${AGNOSTER_STATUS_BG:=black}
|
||||
|
||||
## Non-Color settings - set to 'true' to enable
|
||||
# Show the actual numeric return value rather than a cross symbol.
|
||||
: ${AGNOSTER_STATUS_RETVAL_NUMERIC:=false}
|
||||
# Show git working dir in the style "/git/root master relative/dir" instead of "/git/root/relative/dir master"
|
||||
: ${AGNOSTER_GIT_INLINE:=false}
|
||||
# Show the git branch status in the prompt rather than the generic branch symbol
|
||||
: ${AGNOSTER_GIT_BRANCH_STATUS:=true}
|
||||
|
||||
|
||||
# Special Powerline characters
|
||||
|
||||
() {
|
||||
|
|
@ -83,20 +147,40 @@ prompt_end() {
|
|||
CURRENT_BG=''
|
||||
}
|
||||
|
||||
git_toplevel() {
|
||||
local repo_root=$(git rev-parse --show-toplevel)
|
||||
if [[ $repo_root = '' ]]; then
|
||||
# We are in a bare repo. Use git dir as root
|
||||
repo_root=$(git rev-parse --git-dir)
|
||||
if [[ $repo_root = '.' ]]; then
|
||||
repo_root=$PWD
|
||||
fi
|
||||
fi
|
||||
echo -n $repo_root
|
||||
}
|
||||
|
||||
### Prompt components
|
||||
# Each component will draw itself, and hide itself if no information needs to be shown
|
||||
|
||||
# Context: user@hostname (who am I and where am I)
|
||||
prompt_context() {
|
||||
if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
|
||||
prompt_segment "$AGNOSTER_CONTEXT_BG" "$AGNOSTER_CONTEXT_FG" "%(!.%{%F{$AGNOSTER_STATUS_ROOT_FG}%}.)%n@%m"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_git_relative() {
|
||||
local repo_root=$(git_toplevel)
|
||||
local path_in_repo=$(pwd | sed "s/^$(echo "$repo_root" | sed 's:/:\\/:g;s/\$/\\$/g')//;s:^/::;s:/$::;")
|
||||
if [[ $path_in_repo != '' ]]; then
|
||||
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$path_in_repo"
|
||||
fi;
|
||||
}
|
||||
|
||||
# Git: branch/detached head, dirty status
|
||||
prompt_git() {
|
||||
(( $+commands[git] )) || return
|
||||
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
||||
return
|
||||
fi
|
||||
local PL_BRANCH_CHAR
|
||||
|
|
@ -106,25 +190,29 @@ prompt_git() {
|
|||
}
|
||||
local ref dirty mode repo_path
|
||||
|
||||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||
repo_path=$(command git rev-parse --git-dir 2>/dev/null)
|
||||
dirty=$(parse_git_dirty)
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
||||
ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
|
||||
if [[ -n $dirty ]]; then
|
||||
prompt_segment yellow black
|
||||
prompt_segment "$AGNOSTER_GIT_DIRTY_BG" "$AGNOSTER_GIT_DIRTY_FG"
|
||||
else
|
||||
prompt_segment green $CURRENT_FG
|
||||
prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG"
|
||||
fi
|
||||
|
||||
local ahead behind
|
||||
ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
|
||||
behind=$(git log --oneline ..@{upstream} 2>/dev/null)
|
||||
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21c5'
|
||||
elif [[ -n "$ahead" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21b1'
|
||||
elif [[ -n "$behind" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21b0'
|
||||
if [[ $AGNOSTER_GIT_BRANCH_STATUS == 'true' ]]; then
|
||||
local ahead behind
|
||||
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
|
||||
behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
|
||||
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21c5'
|
||||
elif [[ -n "$ahead" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21b1'
|
||||
elif [[ -n "$behind" ]]; then
|
||||
PL_BRANCH_CHAR=$'\u21b0'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
|
||||
|
|
@ -147,6 +235,7 @@ prompt_git() {
|
|||
zstyle ':vcs_info:*' actionformats ' %u%c'
|
||||
vcs_info
|
||||
echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
||||
[[ $AGNOSTER_GIT_INLINE == 'true' ]] && prompt_git_relative
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -161,17 +250,17 @@ prompt_bzr() {
|
|||
done
|
||||
|
||||
local bzr_status status_mod status_all revision
|
||||
if bzr_status=$(bzr status 2>&1); then
|
||||
if bzr_status=$(command bzr status 2>&1); then
|
||||
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
|
||||
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
||||
revision=${$(bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
||||
revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
||||
if [[ $status_mod -gt 0 ]] ; then
|
||||
prompt_segment yellow black "bzr@$revision ✚"
|
||||
prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision ✚"
|
||||
else
|
||||
if [[ $status_all -gt 0 ]] ; then
|
||||
prompt_segment yellow black "bzr@$revision"
|
||||
prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision"
|
||||
else
|
||||
prompt_segment green black "bzr@$revision"
|
||||
prompt_segment "$AGNOSTER_BZR_CLEAN_BG" "$AGNOSTER_BZR_CLEAN_FG" "bzr@$revision"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
@ -180,33 +269,33 @@ prompt_bzr() {
|
|||
prompt_hg() {
|
||||
(( $+commands[hg] )) || return
|
||||
local rev st branch
|
||||
if $(hg id >/dev/null 2>&1); then
|
||||
if $(hg prompt >/dev/null 2>&1); then
|
||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||
if $(command hg id >/dev/null 2>&1); then
|
||||
if $(command hg prompt >/dev/null 2>&1); then
|
||||
if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
|
||||
# if files are not added
|
||||
prompt_segment red white
|
||||
prompt_segment "$AGNOSTER_HG_NEWFILE_BG" "$AGNOSTER_HG_NEWFILE_FG"
|
||||
st='±'
|
||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||
elif [[ -n $(command hg prompt "{status|modified}") ]]; then
|
||||
# if any modification
|
||||
prompt_segment yellow black
|
||||
prompt_segment "$AGNOSTER_HG_CHANGED_BG" "$AGNOSTER_HG_CHANGED_FG"
|
||||
st='±'
|
||||
else
|
||||
# if working copy is clean
|
||||
prompt_segment green $CURRENT_FG
|
||||
prompt_segment "$AGNOSTER_HG_CLEAN_BG" "$AGNOSTER_HG_CLEAN_FG"
|
||||
fi
|
||||
echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
||||
echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
||||
else
|
||||
st=""
|
||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||
branch=$(hg id -b 2>/dev/null)
|
||||
if `hg st | grep -q "^\?"`; then
|
||||
prompt_segment red black
|
||||
rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||
branch=$(command hg id -b 2>/dev/null)
|
||||
if command hg st | command grep -q "^\?"; then
|
||||
prompt_segment "$AGNOSTER_HG_NEWFILE_BG" "$AGNOSTER_HG_NEWFILE_FG"
|
||||
st='±'
|
||||
elif `hg st | grep -q "^[MA]"`; then
|
||||
prompt_segment yellow black
|
||||
elif command hg st | command grep -q "^[MA]"; then
|
||||
prompt_segment "$AGNOSTER_HG_CHANGED_BG" "$AGNOSTER_HG_CHANGED_FG"
|
||||
st='±'
|
||||
else
|
||||
prompt_segment green $CURRENT_FG
|
||||
prompt_segment "$AGNOSTER_HG_CLEAN_BG" "$AGNOSTER_HG_CLEAN_FG"
|
||||
fi
|
||||
echo -n "☿ ${rev:gs/%/%%}@${branch:gs/%/%%}" $st
|
||||
fi
|
||||
|
|
@ -215,13 +304,21 @@ prompt_hg() {
|
|||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
prompt_segment blue $CURRENT_FG '%~'
|
||||
if [[ $AGNOSTER_GIT_INLINE == 'true' ]] && $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
# Git repo and inline path enabled, hence only show the git root
|
||||
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$(git_toplevel | sed "s:^$HOME:~:")"
|
||||
else
|
||||
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%~'
|
||||
fi
|
||||
}
|
||||
|
||||
# Virtualenv: current working virtualenv
|
||||
prompt_virtualenv() {
|
||||
if [ -n "$CONDA_DEFAULT_ENV" ]; then
|
||||
prompt_segment magenta $CURRENT_FG "🐍 $CONDA_DEFAULT_ENV"
|
||||
fi
|
||||
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
||||
prompt_segment blue black "(${VIRTUAL_ENV:t:gs/%/%%})"
|
||||
prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -232,11 +329,15 @@ prompt_virtualenv() {
|
|||
prompt_status() {
|
||||
local -a symbols
|
||||
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
if [[ $AGNOSTER_STATUS_RETVAL_NUMERIC == 'true' ]]; then
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}$RETVAL"
|
||||
else
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}✘"
|
||||
fi
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_ROOT_FG}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙"
|
||||
|
||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||
[[ -n "$symbols" ]] && prompt_segment "$AGNOSTER_STATUS_BG" "$AGNOSTER_STATUS_FG" "$symbols"
|
||||
}
|
||||
|
||||
#AWS Profile:
|
||||
|
|
@ -247,17 +348,24 @@ prompt_status() {
|
|||
prompt_aws() {
|
||||
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
|
||||
case "$AWS_PROFILE" in
|
||||
*-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||
*) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||
*-prod|*production*) prompt_segment "$AGNOSTER_AWS_PROD_BG" "$AGNOSTER_AWS_PROD_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||
*) prompt_segment "$AGNOSTER_AWS_BG" "$AGNOSTER_AWS_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
prompt_terraform() {
|
||||
local terraform_info=$(tf_prompt_info)
|
||||
[[ -z "$terraform_info" ]] && return
|
||||
prompt_segment magenta yellow "TF: $terraform_info"
|
||||
}
|
||||
|
||||
## Main prompt
|
||||
build_prompt() {
|
||||
RETVAL=$?
|
||||
prompt_status
|
||||
prompt_virtualenv
|
||||
prompt_aws
|
||||
prompt_terraform
|
||||
prompt_context
|
||||
prompt_dir
|
||||
prompt_git
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ $ '
|
|||
RPROMPT='$(ruby_prompt_info)'
|
||||
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=0
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=" %{$fg[green]%}🐍"
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=" %{$fg[green]%}🐍 "
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
PROMPT="%{${fg_bold[blue]}%}[ %{${fg[red]}%}%t %{${fg_bold[blue]}%}] %{${fg_bold[blue]}%} [ %{${fg[red]}%}%n@%m:%~\$(git_prompt_info)%{${fg[yellow]}%}\$(ruby_prompt_info)%{${fg_bold[blue]}%} ]%{$reset_color%}
|
||||
$ "
|
||||
|
||||
PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(ruby_prompt_info)$fg_bold[blue] ]$reset_color
|
||||
$ '
|
||||
# git theming
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green]("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{${fg_bold[green]}%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="✔"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="✗"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,12 @@ $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
|
|||
|
||||
PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} '
|
||||
|
||||
RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
|
||||
__RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
|
||||
if [[ -z $RPROMPT ]]; then
|
||||
RPROMPT=$__RPROMPT
|
||||
else
|
||||
RPROMPT="${RPROMPT} ${__RPROMPT}"
|
||||
fi
|
||||
|
||||
function _user_host() {
|
||||
local me
|
||||
|
|
|
|||
|
|
@ -2,14 +2,20 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|||
local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} "
|
||||
local user_symbol='%(!.#.$)'
|
||||
local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
|
||||
local conda_prompt='$(conda_prompt_info)'
|
||||
|
||||
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
|
||||
local rvm_ruby='$(ruby_prompt_info)'
|
||||
local venv_prompt='$(virtualenv_prompt_info)'
|
||||
if [[ "${plugins[@]}" =~ 'kube-ps1' ]]; then
|
||||
local kube_prompt='$(kube_ps1)'
|
||||
else
|
||||
local kube_prompt=''
|
||||
fi
|
||||
|
||||
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||
|
||||
PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
|
||||
PROMPT="╭─${conda_prompt}${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}${kube_prompt}
|
||||
╰─%B${user_symbol}%b "
|
||||
RPROMPT="%B${return_code}%b"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ function _prompt_char() {
|
|||
# This theme works with both the "dark" and "light" variants of the
|
||||
# Solarized color schema. Set the SOLARIZED_THEME variable to one of
|
||||
# these two values to choose. If you don't specify, we'll assume you're
|
||||
# using the "dark" variant.
|
||||
# using neither variant.
|
||||
|
||||
case ${SOLARIZED_THEME:-dark} in
|
||||
light) bkg=white;;
|
||||
*) bkg=black;;
|
||||
*) bkg=default;;
|
||||
esac
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}"
|
|||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_STASHED="(%{$fg_bold[blue]%}✹%{$reset_color%})"
|
||||
|
||||
bureau_git_info () {
|
||||
local ref
|
||||
|
|
@ -67,6 +68,12 @@ bureau_git_status() {
|
|||
}
|
||||
|
||||
bureau_git_prompt() {
|
||||
# ignore non git folders and hidden repos (adapted from lib/git.zsh)
|
||||
if ! command git rev-parse --git-dir &> /dev/null \
|
||||
|| [[ "$(command git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# check git information
|
||||
local gitinfo=$(bureau_git_info)
|
||||
if [[ -z "$gitinfo" ]]; then
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
# CRUNCH - created from Steve Eley's cat waxing.
|
||||
# Initially hacked from the Dallas theme. Thanks, Dallas Reedy.
|
||||
#
|
||||
# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine,
|
||||
# and eschews the standard space-consuming user and hostname info. Instead, only the
|
||||
# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine,
|
||||
# and eschews the standard space-consuming user and hostname info. Instead, only the
|
||||
# things that vary in my own workflow are shown:
|
||||
#
|
||||
# * The time (not the date)
|
||||
# * The RVM version and gemset (omitting the 'ruby' name if it's MRI)
|
||||
# * The current directory
|
||||
# * The Git branch and its 'dirty' state
|
||||
#
|
||||
#
|
||||
# Colors are at the top so you can mess with those separately if you like.
|
||||
# For the most part I stuck with Dallas's.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# RVM settings
|
||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# There are pre-defined different emoji sets to choose from, e.g.:
|
||||
# emoji, stellar, floral, zodiac, love (see emotty plugin).
|
||||
#
|
||||
#
|
||||
# To choose a different emotty set than the default (emoji)
|
||||
# % export emotty_set=nature
|
||||
#
|
||||
|
|
@ -95,7 +95,7 @@ zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}"
|
|||
# %(k|f) reset (back|fore)ground color
|
||||
zstyle ':vcs_info:*' max-exports 3
|
||||
zstyle ':vcs_info:*' nvcsformats "${prompt_glyph}" '%3~' ''
|
||||
zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
|
||||
zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
|
||||
zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]"
|
||||
|
||||
red_if_root="%(!.%F{red}.)"
|
||||
|
|
|
|||
|
|
@ -8,24 +8,10 @@
|
|||
# - prefix to detect docker containers or chroot
|
||||
# - git plugin to display current branch and status
|
||||
|
||||
# git plugin
|
||||
# git plugin
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="+"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="~"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="!"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="?"
|
||||
|
||||
function zsh_essembeh_gitstatus {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
GIT_STATUS=$(git_prompt_status)
|
||||
if [[ -n $GIT_STATUS ]]; then
|
||||
GIT_STATUS=" $GIT_STATUS"
|
||||
fi
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
# by default, use green for user@host and no prefix
|
||||
local ZSH_ESSEMBEH_COLOR="green"
|
||||
|
|
@ -35,7 +21,7 @@ if [[ -n "$SSH_CONNECTION" ]]; then
|
|||
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} "
|
||||
# use red color to highlight a remote connection
|
||||
ZSH_ESSEMBEH_COLOR="red"
|
||||
elif [[ -r /etc/debian_chroot ]]; then
|
||||
elif [[ -r /etc/debian_chroot ]]; then
|
||||
# prefix prompt in case of chroot
|
||||
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} "
|
||||
elif [[ -r /.dockerenv ]]; then
|
||||
|
|
@ -46,5 +32,5 @@ if [[ $UID = 0 ]]; then
|
|||
# always use magenta for root sessions, even in ssh
|
||||
ZSH_ESSEMBEH_COLOR="magenta"
|
||||
fi
|
||||
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(zsh_essembeh_gitstatus)%(!.#.$) '
|
||||
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(git_prompt_info)%(!.#.$) '
|
||||
RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
|
||||
|
||||
function virtualenv_info {
|
||||
[ $CONDA_DEFAULT_ENV ] && echo "($CONDA_DEFAULT_ENV) "
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ _fishy_collapsed_wd() {
|
|||
}
|
||||
|
||||
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
||||
PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
|
||||
local host_color='white'; [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && host_color='yellow'
|
||||
PROMPT='%{$fg[$user_color]%}%n%{$reset_color%}@%{$fg[$host_color]%}%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
|
||||
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -1,24 +1,140 @@
|
|||
# Depends on the git plugin for work_in_progress()
|
||||
(( $+functions[work_in_progress] )) || work_in_progress() {}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}[%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[cyan]%}]"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
# Customized git status, oh-my-zsh currently does not allow render dirty status before branch
|
||||
git_custom_status() {
|
||||
local branch=$(git_current_branch)
|
||||
[[ -n "$branch" ]] || return 0
|
||||
echo "$(parse_git_dirty)\
|
||||
%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\
|
||||
${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
print "%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\
|
||||
${ZSH_THEME_GIT_PROMPT_PREFIX}$(parse_git_dirty)${branch}\
|
||||
${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
}
|
||||
autoload -U colors && colors
|
||||
|
||||
#export VCS_PROMPT=hg_prompt_info
|
||||
export VCS_PROMPT=git_custom_status
|
||||
|
||||
base_prompt="%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b "
|
||||
custom_prompt=""
|
||||
last_run_time=""
|
||||
last_vcs_info=""
|
||||
|
||||
|
||||
function pipestatus_parse {
|
||||
PIPESTATUS="$pipestatus"
|
||||
ERROR=0
|
||||
for i in "${(z)PIPESTATUS}"; do
|
||||
if [[ "$i" -ne 0 ]]; then
|
||||
ERROR=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$ERROR" -ne 0 ]]; then
|
||||
print "[%{$fg[red]%}$PIPESTATUS%{$fg[cyan]%}]"
|
||||
fi
|
||||
}
|
||||
|
||||
# RVM component of prompt
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}["
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
|
||||
# Combine it all into a final right-side prompt
|
||||
RPS1="\$(git_custom_status)\$(ruby_prompt_info)${RPS1:+ $RPS1}"
|
||||
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
||||
function preexec() {
|
||||
last_run_time=$(perl -MTime::HiRes=time -e 'printf "%.9f\n", time')
|
||||
}
|
||||
|
||||
function duration() {
|
||||
local duration
|
||||
local now=$(perl -MTime::HiRes=time -e 'printf "%.9f\n", time')
|
||||
local last=$1
|
||||
local last_split=("${(@s/./)last}")
|
||||
local now_split=("${(@s/./)now}")
|
||||
local T=$((now_split[1] - last_split[1]))
|
||||
local D=$((T/60/60/24))
|
||||
local H=$((T/60/60%24))
|
||||
local M=$((T/60%60))
|
||||
local S=$((T%60))
|
||||
local s=$(((now_split[2] - last_split[2]) / 1000000000.))
|
||||
local m=$(((now_split[2] - last_split[2]) / 1000000.))
|
||||
|
||||
(( $D > 0 )) && duration+="${D}d"
|
||||
(( $H > 0 )) && duration+="${H}h"
|
||||
(( $M > 0 )) && duration+="${M}m"
|
||||
|
||||
if [[ $S -le 0 ]]; then
|
||||
printf "%ims" "$m"
|
||||
else
|
||||
if ! [[ -z $duration ]] && printf "%s" "$duration"
|
||||
local sec_milli=$((S + s))
|
||||
printf "%.3fs" "$sec_milli"
|
||||
fi
|
||||
}
|
||||
|
||||
function precmd() {
|
||||
RETVAL=$(pipestatus_parse)
|
||||
local info=""
|
||||
|
||||
if [ ! -z "$last_run_time" ]; then
|
||||
local elapsed=$(duration $last_run_time)
|
||||
last_run_time=$(print $last_run_time | tr -d ".")
|
||||
if [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 120 * 1000 * 1000 * 1000 )) ]; then
|
||||
local elapsed_color="%{$fg[magenta]%}"
|
||||
elif [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 60 * 1000 * 1000 * 1000 )) ]; then
|
||||
local elapsed_color="%{$fg[red]%}"
|
||||
elif [ $(( $(perl -MTime::HiRes=time -e 'printf "%.9f\n", time' | tr -d ".") - $last_run_time )) -gt $(( 10 * 1000 * 1000 * 1000 )) ]; then
|
||||
local elapsed_color="%{$fg[yellow]%}"
|
||||
else
|
||||
local elapsed_color="%{$fg[green]%}"
|
||||
fi
|
||||
info=$(printf "%s%s%s%s%s" "%{$fg[cyan]%}[" "$elapsed_color" "$elapsed" "%{$fg[cyan]%}]" "$RETVAL")
|
||||
unset last_run_time
|
||||
fi
|
||||
|
||||
if [ -z "$info" -a ! -z "$last_vcs_info" ]; then
|
||||
custom_prompt="$last_vcs_info$base_prompt"
|
||||
return;
|
||||
fi
|
||||
|
||||
if (( ${+VCS_PROMPT} )); then
|
||||
last_vcs_info=$($VCS_PROMPT)
|
||||
if [ ! -z "$last_vcs_info" ]; then
|
||||
[ -z "$info" ] && info=$last_vcs_info || info="$info$last_vcs_info"
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -z "$info" ] && custom_prompt="$base_prompt" || custom_prompt="$info$base_prompt"
|
||||
}
|
||||
|
||||
function hg_prompt_info() {
|
||||
unset output info parts branch_parts branch
|
||||
|
||||
local output=""
|
||||
if ! output="$(hg status 2> /dev/null)"; then
|
||||
return
|
||||
fi
|
||||
|
||||
local info=$(hg log -l1 --template '{author}:{node|short}:{remotenames}:{phabdiff}')
|
||||
local parts=(${(@s/:/)info})
|
||||
local branch_parts=(${(@s,/,)parts[3]})
|
||||
local branch=${branch_parts[-1]}
|
||||
[ ! -z "${parts[3]}" ] && [[ "${parts[1]}" =~ "$USER@" ]] && branch=${parts[3]}
|
||||
[ -z "${parts[3]}" ] && branch=${parts[2]}
|
||||
|
||||
if [[ ! -z "$output" ]]; then
|
||||
local color="%{$fg[red]%}"
|
||||
elif [[ "${branch}" == "master" || "${branch}" == "warm" ]]; then
|
||||
local color="%{$fg[yellow]%}"
|
||||
else
|
||||
local color="%{$fg[green]%}"
|
||||
fi
|
||||
|
||||
print "%{$fg[cyan]%}[${color}${branch}%{$fg[cyan]%}]"
|
||||
}
|
||||
|
||||
setopt PROMPT_SUBST
|
||||
PROMPT='$custom_prompt'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ fi
|
|||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||
PR_HOST='%F{red}%M%f' # SSH
|
||||
else
|
||||
PR_HOST='%F{green}%M%f' # no SSH
|
||||
PR_HOST='%F{green}%m%f' # no SSH
|
||||
fi
|
||||
|
||||
|
||||
|
|
@ -30,8 +30,9 @@ local return_code="%(?..%F{red}%? ↵%f)"
|
|||
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
||||
local current_dir="%B%F{blue}%~%f%b"
|
||||
local git_branch='$(git_prompt_info)'
|
||||
local venv_prompt='$(virtualenv_prompt_info)'
|
||||
|
||||
PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
||||
PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
||||
╰─$PR_PROMPT "
|
||||
RPROMPT="${return_code}"
|
||||
|
||||
|
|
@ -39,5 +40,7 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
|||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
|
||||
ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,5 +89,9 @@ ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} "
|
|||
ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_RVM_PROMPT_OPTIONS="v g"
|
||||
|
||||
# virtualenv prompt settings
|
||||
ZSH_THEME_VIRTUALENV_PREFIX=" with%F{red} "
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX="%{$reset_color%}"
|
||||
|
||||
setopt prompt_subst
|
||||
PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "
|
||||
PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(virtualenv_prompt_info)\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "
|
||||
|
|
|
|||
|
|
@ -7,14 +7,16 @@ function theme_precmd {
|
|||
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
||||
local rubypromptsize=${#${(%)$(ruby_prompt_info)}}
|
||||
local pwdsize=${#${(%):-%~}}
|
||||
local venvpromptsize=$((${#$(virtualenv_prompt_info)}))
|
||||
local condapromptsize=$((${#$(conda_prompt_info)}))
|
||||
|
||||
# Truncate the path if it's too long.
|
||||
if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then
|
||||
if (( promptsize + rubypromptsize + pwdsize + venvpromptsize + condapromptsize > TERMWIDTH )); then
|
||||
(( PR_PWDLEN = TERMWIDTH - promptsize ))
|
||||
elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
|
||||
PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}"
|
||||
PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize + condapromptsize ) ))::${PR_HBAR}:)}"
|
||||
else
|
||||
PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
|
||||
PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize + condapromptsize ) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +105,7 @@ fi
|
|||
PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\
|
||||
${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\
|
||||
${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\
|
||||
${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\
|
||||
${PR_GREY})$(virtualenv_prompt_info)$(ruby_prompt_info)$(conda_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\
|
||||
${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\
|
||||
${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function josh_prompt {
|
|||
branch_size=${#branch}
|
||||
ruby_size=${#ruby_version}
|
||||
user_machine_size=${#${(%):-%n@%m-}}
|
||||
|
||||
|
||||
if [[ ${#branch} -eq 0 ]]
|
||||
then (( ruby_size = ruby_size + 1 ))
|
||||
else
|
||||
|
|
@ -24,15 +24,15 @@ function josh_prompt {
|
|||
(( branch_size = branch_size + 2 ))
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
(( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
|
||||
|
||||
while [ ${#prompt} -lt $spare_width ]; do
|
||||
prompt=" $prompt"
|
||||
done
|
||||
|
||||
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} $(git_current_branch)"
|
||||
|
||||
|
||||
echo $prompt
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,11 @@ ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)"
|
|||
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}"
|
||||
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
|
||||
|
||||
USER_COLOR=$GREEN_BOLD
|
||||
[[ $UID -eq 0 ]] && USER_COLOR=$RED_BOLD
|
||||
|
||||
# Prompt format
|
||||
PROMPT='
|
||||
%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
|
||||
%{$USER_COLOR%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
|
||||
%{$BLUE%}>%{$RESET_COLOR%} '
|
||||
RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
# Grab the current date (%W) and time (%t):
|
||||
JUNKFOOD_TIME_="%{$fg_bold[red]%}#%{$fg_bold[white]%}( %{$fg_bold[yellow]%}%W%{$reset_color%}@%{$fg_bold[white]%}%t )( %{$reset_color%}"
|
||||
|
||||
# Grab the current machine name
|
||||
# Grab the current machine name
|
||||
JUNKFOOD_MACHINE_="%{$fg_bold[blue]%}%m%{$fg[white]%} ):%{$reset_color%}"
|
||||
|
||||
# Grab the current username
|
||||
# Grab the current username
|
||||
JUNKFOOD_CURRENT_USER_="%{$fg_bold[green]%}%n%{$reset_color%}"
|
||||
|
||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||
|
|
|
|||
|
|
@ -29,14 +29,13 @@ local cyan="%{$fg_bold[cyan]%}"
|
|||
local yellow="%{$fg_bold[yellow]%}"
|
||||
local blue="%{$fg_bold[blue]%}"
|
||||
local magenta="%{$fg_bold[magenta]%}"
|
||||
local white="%{$fg_bold[white]%}"
|
||||
local reset="%{$reset_color%}"
|
||||
|
||||
local -a color_array
|
||||
color_array=($green $red $cyan $yellow $blue $magenta $white)
|
||||
color_array=($green $red $cyan $yellow $blue $magenta)
|
||||
|
||||
local username_color=$white
|
||||
local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character
|
||||
local username_color=$blue
|
||||
local hostname_color=$color_array[$[((#HOST))%6+1]] # choose hostname color based on first character
|
||||
local current_dir_color=$blue
|
||||
|
||||
local username="%n"
|
||||
|
|
@ -66,10 +65,10 @@ function michelebologna_git_prompt {
|
|||
local out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status)
|
||||
[[ -n $out ]] || return
|
||||
printf " %s(%s%s%s)%s" \
|
||||
"%{$fg_bold[white]%}" \
|
||||
"%{$fg_bold[blue]%}" \
|
||||
"%{$fg_bold[green]%}" \
|
||||
"$out" \
|
||||
"%{$fg_bold[white]%}" \
|
||||
"%{$fg_bold[blue]%}" \
|
||||
"%{$reset_color%}"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
|
||||
# for example in your ~/.zshrc file, like this:
|
||||
# MLH_AT_SYMBOL=" at "
|
||||
#
|
||||
#
|
||||
# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
|
||||
#
|
||||
# To easily discover colors and their codes, type `spectrum_ls` in the terminal
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
function my_git_prompt() {
|
||||
tester=$(git rev-parse --git-dir 2> /dev/null) || return
|
||||
|
||||
|
||||
INDEX=$(git status --porcelain 2> /dev/null)
|
||||
STATUS=""
|
||||
|
||||
|
|
@ -51,8 +51,14 @@ function ssh_connection() {
|
|||
fi
|
||||
}
|
||||
|
||||
function _toolbox_prompt_info() {
|
||||
if typeset -f toolbox_prompt_info > /dev/null; then
|
||||
toolbox_prompt_info
|
||||
fi
|
||||
}
|
||||
|
||||
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
|
||||
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
|
||||
PROMPT=$'\n$(_toolbox_prompt_info)$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
|
||||
|
||||
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
|
||||
|
|
|
|||
12
themes/nicoulaj.zsh-theme
Normal file → Executable file
12
themes/nicoulaj.zsh-theme
Normal file → Executable file
|
|
@ -12,12 +12,12 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Customizable parameters.
|
||||
PROMPT_PATH_MAX_LENGTH=30
|
||||
PROMPT_DEFAULT_END=❯
|
||||
PROMPT_ROOT_END=❯❯❯
|
||||
PROMPT_SUCCESS_COLOR=$FG[071]
|
||||
PROMPT_FAILURE_COLOR=$FG[124]
|
||||
PROMPT_VCS_INFO_COLOR=$FG[242]
|
||||
PROMPT_PATH_MAX_LENGTH=${PROMPT_PATH_MAX_LENGTH:-30}
|
||||
PROMPT_DEFAULT_END=${PROMPT_DEFAULT_END:-❯}
|
||||
PROMPT_ROOT_END=${PROMPT_ROOT_END:-❯❯❯}
|
||||
PROMPT_SUCCESS_COLOR=${PROMPT_SUCCESS_COLOR:-$FG[071]}
|
||||
PROMPT_FAILURE_COLOR=${PROMPT_FAILURE_COLOR:-$FG[124]}
|
||||
PROMPT_VCS_INFO_COLOR=${PROMPT_VCS_INFO_COLOR:-$FG[242]}
|
||||
|
||||
# Set required options.
|
||||
setopt promptsubst
|
||||
|
|
|
|||
24
themes/oldgallois.zsh-theme
Normal file
24
themes/oldgallois.zsh-theme
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Depends on the git plugin for work_in_progress()
|
||||
(( $+functions[work_in_progress] )) || work_in_progress() {}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
# Customized git status, oh-my-zsh currently does not allow render dirty status before branch
|
||||
git_custom_status() {
|
||||
local branch=$(git_current_branch)
|
||||
[[ -n "$branch" ]] || return 0
|
||||
echo "$(parse_git_dirty)\
|
||||
%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\
|
||||
${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
# RVM component of prompt
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}["
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}"
|
||||
|
||||
# Combine it all into a final right-side prompt
|
||||
RPS1="\$(git_custom_status)\$(ruby_prompt_info)${RPS1:+ $RPS1}"
|
||||
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
||||
|
|
@ -1,32 +1,12 @@
|
|||
# Yay! High voltage and arrows!
|
||||
|
||||
prompt_setup_pygmalion(){
|
||||
setopt localoptions extendedglob
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{${reset_color}%}%F{green}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{${reset_color}%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%F{yellow}⚡%f"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
base_prompt="%{${reset_color}%}%F{magenta}%n%F{cyan}@%F{yellow}%m%F{red}:%F{cyan}%0~%F{red}|%f"
|
||||
post_prompt="%{${reset_color}%}%F{cyan}⇒%f "
|
||||
|
||||
base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
|
||||
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
|
||||
|
||||
base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
|
||||
post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd prompt_pygmalion_precmd
|
||||
}
|
||||
|
||||
prompt_pygmalion_precmd(){
|
||||
setopt localoptions nopromptsubst extendedglob
|
||||
|
||||
local gitinfo=$(git_prompt_info)
|
||||
local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
|
||||
local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")"
|
||||
local prompt_length=${#exp_nocolor}
|
||||
|
||||
PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}"
|
||||
}
|
||||
|
||||
prompt_setup_pygmalion
|
||||
PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}"
|
||||
unset base_prompt post_prompt
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# user, host, full path, and time/date on two lines for easier vgrepping
|
||||
|
||||
function hg_prompt_info {
|
||||
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
|
||||
if (( $+commands[hg] )) && [[ -e ~/.hgrc ]] && grep -q "prompt" ~/.hgrc; then
|
||||
hg prompt --angle-brackets "\
|
||||
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
|
||||
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%c%{$reset_color%}"
|
||||
PROMPT+=' $(git_prompt_info)'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%1{✗%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
#!/usr/bin/env zsh
|
||||
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
|
||||
setopt promptsubst
|
||||
|
|
@ -29,7 +29,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :"
|
|||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist)
|
||||
# - Open Terminal preferences. Go to Settings -> Text -> More
|
||||
# - Change default colours to your liking.
|
||||
#
|
||||
#
|
||||
# Here are the colours from Textmate's Monokai theme:
|
||||
#
|
||||
#
|
||||
# Black: 0, 0, 0
|
||||
# Red: 229, 34, 34
|
||||
# Green: 166, 227, 45
|
||||
|
|
@ -28,7 +28,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
|
|||
RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
|
||||
|
||||
# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
|
||||
# $(ruby_prompt_info)
|
||||
# $(ruby_prompt_info)
|
||||
|
||||
# local time, color coded by last return code
|
||||
time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
|
||||
|
|
@ -53,7 +53,7 @@ ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
|
|||
|
||||
# More symbols to choose from:
|
||||
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
|
||||
# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
|
||||
# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠
|
||||
# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟ ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ
|
||||
|
||||
# Determine if we are using a gemset.
|
||||
|
|
@ -61,7 +61,7 @@ function rvm_gemset() {
|
|||
GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
|
||||
if [[ -n $GEMSET ]]; then
|
||||
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine the time since last commit. If branch is clean,
|
||||
|
|
@ -76,12 +76,12 @@ function git_time_since_commit() {
|
|||
# Totals
|
||||
MINUTES=$((seconds_since_last_commit / 60))
|
||||
HOURS=$((seconds_since_last_commit/3600))
|
||||
|
||||
|
||||
# Sub-hours and sub-minutes
|
||||
DAYS=$((seconds_since_last_commit / 86400))
|
||||
SUB_HOURS=$((HOURS % 24))
|
||||
SUB_MINUTES=$((MINUTES % 60))
|
||||
|
||||
|
||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
||||
if [ "$MINUTES" -gt 30 ]; then
|
||||
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue