forked from sorin-ionescu/prezto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
- Loading branch information
1 parent
1bc4235
commit 03336db
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# | ||
# 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 | ||
} | ||
|
||
function prompt_smiley_setup { | ||
unsetopt XTRACE KSH_ARRAYS | ||
prompt_opts=(percent subst) | ||
|
||
# Add hook for calling git-info before each command. | ||
add-zsh-hook precmd prompt_smiley_precmd | ||
|
||
# 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 ' | ||
|
||
# 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. | ||
PROMPT='$python_info[virtualenv]${git_info[prompt]} %B%c%b %(?:%F{green}ツ%f:%F{red}✖%f) ' | ||
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 "$@" |