1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prezto/modules/prompt/functions/prompt_steeef_setup

117 lines
3.2 KiB

#
# A theme based on Steve Losh's Extravagant Prompt with vcs_info integration.
#
# Authors:
# Steve Losh <steve@stevelosh.com>
# Bart Trojanowski <bart@jukie.net>
# Brian Carper <brian@carper.ca>
# steeef <steeef@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Screenshots:
# http://i.imgur.com/HyRvv.png
#
function prompt_steeef_precmd {
# Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
10 years ago
branch_format="${_prompt_steeef_colors[1]}%b%f%u%c"
else
10 years ago
branch_format="${_prompt_steeef_colors[1]}%b%f%u%c"
fi
10 years ago
zstyle ':vcs_info:*:prompt:*' formats "${_prompt_steeef_colors[6]}on%f git:${branch_format}" "%r"
vcs_info 'prompt'
if (( $+functions[python-info] )); then
python-info
fi
}
function prompt_steeef_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
# Add hook for calling vcs_info before each command.
add-zsh-hook precmd prompt_steeef_precmd
# Use extended color pallete if available.
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
_prompt_steeef_colors=(
10 years ago
"%F{37}" # Turquoise
"%F{136}" # Orange
"%F{125}" # Purple
"%F{160}" # Hotpink
"%F{64}" # Limegreen
"%F{254}"
"%F{230}"
"%F{166}"
"%F{160}"
"%F{33}"
"%F{234}"
"%F{235}"
"%F{240}"
"%F{241}"
"%F{244}"
"%F{245}"
)
else
_prompt_steeef_colors=(
10 years ago
"%F{cyan}" # 1
"%F{yellow}" # 2
"%F{magenta}" # 3
"%F{red}" # 4
"%F{green}" # 5
"%F{white}" # 6
"%F{brwhite}" # 7
"%F{brred}" # 8
"%F{red}" # 9
"%F{blue}" # 10
"%F{brblack}" # 11
"%F{black}" # 12
"%F{brgreen}" # 13
"%F{bryellow}" # 14
"%F{brblue}" # 15
"%F{brcyan}" # 16
)
fi
# Formats:
# %b - branchname
# %u - unstagedstr (see below)
# %c - stagedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
10 years ago
local branch_format="${_prompt_steeef_colors[1]}%b%f%u%c"
local action_format="${_prompt_steeef_colors[5]}%a%f"
local unstaged_format="${_prompt_steeef_colors[2]} *%f"
local staged_format="${_prompt_steeef_colors[5]} *%f"
# Set vcs_info parameters.
zstyle ':vcs_info:*' enable bzr git hg svn
zstyle ':vcs_info:*:prompt:*' check-for-changes true
zstyle ':vcs_info:*:prompt:*' unstagedstr "${unstaged_format}"
zstyle ':vcs_info:*:prompt:*' stagedstr "${staged_format}"
10 years ago
zstyle ':vcs_info:*:prompt:*' actionformats "${branch_format} ${action_format}"
10 years ago
zstyle ':vcs_info:*:prompt:*' formats "${branch_format}" "%r"
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
# Set python-info parameters.
zstyle ':prezto:module:python:info:virtualenv' format '(%v)'
# Define prompts.
PROMPT="
10 years ago
${_prompt_steeef_colors[1]}%n%f ${_prompt_steeef_colors[6]}at%f ${_prompt_steeef_colors[5]}%m%f ${_prompt_steeef_colors[6]}in%f ${_prompt_steeef_colors[2]}%~%f "'${vcs_info_msg_0_}'"
"'$python_info[virtualenv]'"${_prompt_steeef_colors[4]}$%f "
RPROMPT=''
}
prompt_steeef_setup "$@"