2014-03-10 20:31:14 +00:00
|
|
|
#
|
|
|
|
# A simple theme that displays:
|
|
|
|
# - Python virtual environment.
|
|
|
|
# - Git branch.
|
|
|
|
# - Git state.
|
|
|
|
# - Last command exit state (smiley/X).
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Nadav Shatz <nadavshatz@gmail.com>
|
|
|
|
#
|
|
|
|
# Screenshots:
|
|
|
|
# http://i.imgur.com/ijycV6n.png
|
|
|
|
#
|
|
|
|
|
|
|
|
# Load dependencies.
|
|
|
|
pmodload 'helper'
|
|
|
|
|
|
|
|
function prompt_smiley_precmd {
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
|
|
|
# Get Git repository information.
|
|
|
|
if (( $+functions[git-info] )); then
|
|
|
|
git-info
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get Python environment information.
|
|
|
|
if (( $+functions[python-info] )); then
|
|
|
|
python-info
|
|
|
|
fi
|
2014-03-10 20:48:47 +00:00
|
|
|
|
|
|
|
# Get Ruby version information.
|
|
|
|
if (( $+functions[ruby-info] )); then
|
|
|
|
ruby-info
|
|
|
|
fi
|
2014-03-10 20:31:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_smiley_setup {
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
2018-04-06 18:35:39 +00:00
|
|
|
prompt_opts=(cr percent sp subst)
|
2014-03-10 20:31:14 +00:00
|
|
|
|
|
|
|
# Add hook for calling git-info before each command.
|
|
|
|
add-zsh-hook precmd prompt_smiley_precmd
|
|
|
|
|
2019-07-25 22:14:43 +00:00
|
|
|
# Tell prezto we can manage this prompt
|
|
|
|
zstyle ':prezto:module:prompt' managed 'yes'
|
|
|
|
|
2014-03-10 20:31:14 +00:00
|
|
|
# Set editor-info parameters.
|
|
|
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
|
|
|
|
|
|
|
# Set python-info parameters.
|
|
|
|
zstyle ':prezto:module:python:info:virtualenv' format '%F{yellow}[%v]%f '
|
|
|
|
|
2014-03-10 20:48:47 +00:00
|
|
|
# Set ruby-info parameters.
|
|
|
|
zstyle ':prezto:module:ruby:info:version' format '%F{yellow}[%v]%f '
|
|
|
|
|
2014-03-10 20:31:14 +00:00
|
|
|
# Set git-info parameters.
|
|
|
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
|
|
|
zstyle ':prezto:module:git:info:branch' format '%F{blue}%b%f'
|
|
|
|
zstyle ':prezto:module:git:info:dirty' format '%%B%F{red} ±%f%%b'
|
|
|
|
zstyle ':prezto:module:git:info:keys' format 'prompt' '(%b%D)'
|
|
|
|
|
|
|
|
# Define prompts.
|
2014-12-02 06:28:02 +00:00
|
|
|
PROMPT='$python_info[virtualenv]$ruby_info[version]${git_info:+${(e)git_info[prompt]}} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) '
|
2014-03-10 20:31:14 +00:00
|
|
|
RPROMPT='${editor_info[overwrite]}${VIM:+" %B%F{green}V%f%b"}'
|
|
|
|
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_smiley_setup "$@"
|
2019-07-25 22:14:43 +00:00
|
|
|
# vim: ft=zsh
|