2011-07-18 00:15:51 +00:00
|
|
|
#
|
2012-08-06 20:43:34 +00:00
|
|
|
# A theme based on Steve Losh's Extravagant Prompt with vcs_info integration.
|
2012-02-01 04:37:51 +00:00
|
|
|
#
|
|
|
|
# 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>
|
2011-07-18 00:15:51 +00:00
|
|
|
#
|
2012-08-06 20:53:03 +00:00
|
|
|
# Screenshots:
|
|
|
|
# http://i.imgur.com/HyRvv.png
|
|
|
|
#
|
2011-07-18 00:15:51 +00:00
|
|
|
|
2012-03-23 18:57:51 +00:00
|
|
|
function prompt_steeef_precmd {
|
2012-08-06 20:43:34 +00:00
|
|
|
# Check for untracked files or updated submodules since vcs_info does not.
|
2012-08-06 19:44:13 +00:00
|
|
|
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
2012-08-06 20:43:34 +00:00
|
|
|
branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c${_prompt_steeef_colors[4]}●%f)"
|
2012-08-06 19:44:13 +00:00
|
|
|
else
|
2012-08-06 20:43:34 +00:00
|
|
|
branch_format="(${_prompt_steeef_colors[1]}%b%f%u%c)"
|
2011-07-18 00:15:51 +00:00
|
|
|
fi
|
|
|
|
|
2012-08-06 20:43:34 +00:00
|
|
|
zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
|
2011-07-18 00:15:51 +00:00
|
|
|
|
2012-08-06 19:44:13 +00:00
|
|
|
vcs_info 'prompt'
|
2012-09-03 14:34:41 +00:00
|
|
|
|
|
|
|
if (( $+functions[python-info] )); then
|
|
|
|
python-info
|
|
|
|
fi
|
2011-07-18 00:15:51 +00:00
|
|
|
}
|
|
|
|
|
2012-03-23 18:57:51 +00:00
|
|
|
function prompt_steeef_setup {
|
2011-10-11 02:16:12 +00:00
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
2017-08-10 18:23:26 +00:00
|
|
|
prompt_opts=(cr percent sp subst)
|
2011-07-18 00:15:51 +00:00
|
|
|
|
2012-08-06 19:44:13 +00:00
|
|
|
# Load required functions.
|
2011-07-18 00:15:51 +00:00
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
|
2012-08-06 19:44:13 +00:00
|
|
|
# Add hook for calling vcs_info before each command.
|
2011-07-18 00:15:51 +00:00
|
|
|
add-zsh-hook precmd prompt_steeef_precmd
|
|
|
|
|
2019-07-25 22:14:43 +00:00
|
|
|
# Tell prezto we can manage this prompt
|
|
|
|
zstyle ':prezto:module:prompt' managed 'yes'
|
|
|
|
|
2011-07-18 00:15:51 +00:00
|
|
|
# Use extended color pallete if available.
|
|
|
|
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
2012-08-06 19:44:13 +00:00
|
|
|
_prompt_steeef_colors=(
|
2012-08-06 20:43:34 +00:00
|
|
|
"%F{81}" # Turquoise
|
|
|
|
"%F{166}" # Orange
|
|
|
|
"%F{135}" # Purple
|
|
|
|
"%F{161}" # Hotpink
|
|
|
|
"%F{118}" # Limegreen
|
2011-07-18 00:15:51 +00:00
|
|
|
)
|
|
|
|
else
|
2012-08-06 19:44:13 +00:00
|
|
|
_prompt_steeef_colors=(
|
2011-07-18 00:15:51 +00:00
|
|
|
"%F{cyan}"
|
|
|
|
"%F{yellow}"
|
|
|
|
"%F{magenta}"
|
|
|
|
"%F{red}"
|
|
|
|
"%F{green}"
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Formats:
|
2012-08-06 20:43:34 +00:00
|
|
|
# %b - branchname
|
|
|
|
# %u - unstagedstr (see below)
|
|
|
|
# %c - stagedstr (see below)
|
|
|
|
# %a - action (e.g. rebase-i)
|
|
|
|
# %R - repository path
|
|
|
|
# %S - path in the repository
|
|
|
|
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"
|
2011-07-18 00:15:51 +00:00
|
|
|
|
2018-10-14 04:09:14 +00:00
|
|
|
# Set editor-info parameters.
|
|
|
|
zstyle ':prezto:module:editor:info:keymap:primary' format '$'
|
|
|
|
|
2012-08-06 20:43:34 +00:00
|
|
|
# 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}"
|
|
|
|
zstyle ':vcs_info:*:prompt:*' actionformats "${branch_format}${action_format}"
|
|
|
|
zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
|
2011-07-18 00:15:51 +00:00
|
|
|
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
|
|
|
|
|
2012-09-03 14:34:41 +00:00
|
|
|
# Set python-info parameters.
|
2012-10-02 02:02:47 +00:00
|
|
|
zstyle ':prezto:module:python:info:virtualenv' format '(%v)'
|
2012-09-03 14:34:41 +00:00
|
|
|
|
2012-08-06 20:43:34 +00:00
|
|
|
# Define prompts.
|
2011-07-18 00:15:51 +00:00
|
|
|
PROMPT="
|
2012-08-06 19:44:13 +00:00
|
|
|
${_prompt_steeef_colors[3]}%n%f at ${_prompt_steeef_colors[2]}%m%f in ${_prompt_steeef_colors[5]}%~%f "'${vcs_info_msg_0_}'"
|
2018-10-14 04:09:14 +00:00
|
|
|
"'$python_info[virtualenv]${editor_info[keymap]} '
|
2012-09-10 17:23:34 +00:00
|
|
|
RPROMPT=''
|
2011-07-18 00:15:51 +00:00
|
|
|
}
|
|
|
|
|
2018-10-14 04:09:14 +00:00
|
|
|
function prompt_steeef_preview {
|
|
|
|
local +h PROMPT=''
|
|
|
|
local +h RPROMPT=''
|
|
|
|
local +h SPROMPT=''
|
|
|
|
|
|
|
|
editor-info 2> /dev/null
|
|
|
|
prompt_preview_theme 'steeef'
|
|
|
|
}
|
|
|
|
|
2011-07-18 00:15:51 +00:00
|
|
|
prompt_steeef_setup "$@"
|
2019-07-25 22:14:43 +00:00
|
|
|
# vim: ft=zsh
|