2014-08-26 05:54:05 +00:00
|
|
|
#
|
|
|
|
# A minimal two-color theme.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Kevin Laude <nerfyoda@gmail.com>
|
|
|
|
#
|
|
|
|
# Features:
|
|
|
|
# - One line, left aligned.
|
|
|
|
# - The prompt is prefixed by a character sequence of your choice.
|
|
|
|
# - Only displays the current directory instead of the full path.
|
|
|
|
# - Displays the current branch when in a git project (this requires loading
|
|
|
|
# the git module before prompt in ~/.zpreztorc).
|
|
|
|
# - Displays a character at the end of the prompt when in a git project with
|
|
|
|
# "dirty" files.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# This prompt's prefix symbol and colors are customizable:
|
|
|
|
# prompt cloud [<symbol>] [<color1>] [<color2>]
|
|
|
|
#
|
|
|
|
# In ~/.zpreztorc:
|
|
|
|
# zstyle ':prezto:module:prompt' theme 'cloud' \
|
|
|
|
# ['<symbol>'] \
|
|
|
|
# ['<color1>'] \
|
|
|
|
# ['<color2>']
|
|
|
|
#
|
|
|
|
# If these options are not provided, the symbol defaults to "☁" with colors
|
|
|
|
# cyan and green.
|
|
|
|
#
|
|
|
|
# Screenshots:
|
|
|
|
# http://i.imgur.com/mJCZ8rE.png
|
|
|
|
#
|
|
|
|
# Note:
|
|
|
|
# This is a port of the oh-my-zsh cloud theme, originally written by Phillip
|
|
|
|
# Ridlen <p@rdln.net> and Mark Drago <markdrago@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
# Load dependencies.
|
|
|
|
pmodload 'helper'
|
|
|
|
|
|
|
|
function prompt_cloud_precmd {
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
|
|
|
# Get Git repository information.
|
|
|
|
if (( $+functions[git-info] )); then
|
|
|
|
git-info
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_cloud_help {
|
|
|
|
cat <<EOT
|
|
|
|
This prompt's prefix symbol and colors are customizable:
|
|
|
|
|
|
|
|
prompt cloud [<symbol>] [<color1>] [<color2>]
|
|
|
|
|
|
|
|
In ~/.zpreztorc:
|
|
|
|
zstyle ':prezto:module:prompt' theme 'cloud' ['<symbol>'] ['<color1>'] ['<color2>']
|
|
|
|
|
|
|
|
If these options are not provided, the symbol defaults to ☁ with colors cyan
|
|
|
|
and green.
|
|
|
|
EOT
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_cloud_preview {
|
|
|
|
if (( $# > 0 )); then
|
|
|
|
prompt_preview_theme 'cloud' "$@"
|
|
|
|
else
|
|
|
|
prompt_preview_theme 'cloud'
|
|
|
|
print
|
|
|
|
prompt_preview_theme 'cloud' "✯"
|
|
|
|
print
|
|
|
|
prompt_preview_theme 'cloud' ">" "yellow" "red"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_cloud_setup {
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
2017-08-10 18:23:26 +00:00
|
|
|
prompt_opts=(cr percent sp subst)
|
2014-08-26 05:54:05 +00:00
|
|
|
|
|
|
|
# Set the theme prefix to a cloud or to the user's given characters.
|
|
|
|
if [[ -n "$1" ]]; then
|
|
|
|
prefix="$1"
|
|
|
|
else
|
|
|
|
prefix='☁'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Assign colors.
|
|
|
|
if [[ -n "$2" ]]; then
|
|
|
|
primary_color="$2"
|
|
|
|
else
|
|
|
|
primary_color='cyan'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$3" ]]; then
|
|
|
|
secondary_color="$3"
|
|
|
|
else
|
|
|
|
secondary_color='green'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load required functions.
|
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
|
|
|
|
# Add hook for calling git-info before each command.
|
|
|
|
add-zsh-hook precmd prompt_cloud_precmd
|
|
|
|
|
2019-07-25 22:14:43 +00:00
|
|
|
# Tell prezto we can manage this prompt
|
|
|
|
zstyle ':prezto:module:prompt' managed 'yes'
|
|
|
|
|
2014-08-26 05:54:05 +00:00
|
|
|
# Set git-info parameters.
|
|
|
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
|
|
|
zstyle ':prezto:module:git:info:dirty' format "%%B%F{$secondary_color}]%f%%b %F{yellow}⚡%f"
|
|
|
|
zstyle ':prezto:module:git:info:clean' format "%B%F{$secondary_color}]%f%b"
|
|
|
|
zstyle ':prezto:module:git:info:branch' format "%%B%F{$secondary_color}[%f%%b%%B%F{$primary_color}%b%f%%b"
|
|
|
|
zstyle ':prezto:module:git:info:keys' format \
|
|
|
|
'prompt' '%b%C%D' \
|
|
|
|
'rprompt' ''
|
|
|
|
|
|
|
|
# Define prompts.
|
2014-12-02 06:28:02 +00:00
|
|
|
PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+${(e)git_info[prompt]}} '
|
2014-08-26 05:54:05 +00:00
|
|
|
RPROMPT=''
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_cloud_setup "$@"
|
2019-07-25 22:14:43 +00:00
|
|
|
# vim: ft=zsh
|