114 lines
4.9 KiB
Plaintext
114 lines
4.9 KiB
Plaintext
#
|
|
# All information at your chilly fingertips.
|
|
#
|
|
# Authors:
|
|
# Tom Frost <tom@ianonavyeddesign.com>
|
|
# Ian Naval <ian@ianonavy.com>
|
|
#
|
|
# Screenshots:
|
|
# http://i.tomfro.st/U1Kov.png
|
|
#
|
|
|
|
# Dependencies
|
|
pmodload 'helper'
|
|
|
|
function prompt_ianonavy_precmd {
|
|
setopt LOCAL_OPTIONS
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
if (( $+functions[git-info] )); then
|
|
git-info
|
|
fi
|
|
|
|
if (( $+functions[python-info] )); then
|
|
python-info
|
|
fi
|
|
}
|
|
|
|
function prompt_ianonavy_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_ianonavy_precmd
|
|
|
|
_prompt_ianonavy_nocolor="%{$terminfo[sgr0]%}"
|
|
_prompt_ianonavy_colors=(
|
|
"${_prompt_ianonavy_nocolor}%F{blue}"
|
|
"${_prompt_ianonavy_nocolor}%F{blue}%{$terminfo[bold]%}"
|
|
"${_prompt_ianonavy_nocolor}%F{green}"
|
|
"${_prompt_ianonavy_nocolor}%F{green}%{$terminfo[bold]%}"
|
|
"${_prompt_ianonavy_nocolor}%F{red}"
|
|
"${_prompt_ianonavy_nocolor}%F{red}%{$terminfo[bold]%}"
|
|
"${_prompt_ianonavy_nocolor}%F{yellow}"
|
|
"${_prompt_ianonavy_nocolor}%F{yellow}%{$terminfo[bold]%}"
|
|
"${_prompt_ianonavy_nocolor}%F{magenta}"
|
|
"${_prompt_ianonavy_nocolor}%F{magenta}%{$terminfo[bold]%}"
|
|
"${_prompt_ianonavy_nocolor}%F{white}"
|
|
"${_prompt_ianonavy_nocolor}%F{white}%{$terminfo[bold]%}"
|
|
)
|
|
|
|
# Set editor-info params
|
|
zstyle ':prezto:module:editor:info:completing' format '${_prompt_ianonavy_colors[5]}...${_prompt_ianonavy_nocolor}'
|
|
if tty | fgrep pts >/dev/null ; then
|
|
zstyle ':prezto:module:editor:info:keymap:primary' format '➤'
|
|
else
|
|
zstyle ':prezto:module:editor:info:keymap:primary' format '>'
|
|
fi
|
|
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format '♺'
|
|
zstyle ':prezto:module:editor:info:keymap:alternate' format '⍟'
|
|
|
|
# Set git-info parameters
|
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
|
zstyle ':prezto:module:git:info:action' format "${_prompt_ianonavy_colors[1]}∙${_prompt_ianonavy_colors[7]}%s${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:added' format "${_prompt_ianonavy_colors[4]}✚${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:ahead' format "${_prompt_ianonavy_colors[8]}⚡${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:behind' format "${_prompt_ianonavy_colors[8]}↯${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:branch' format "${_prompt_ianonavy_colors[1]}∙${_prompt_ianonavy_colors[2]}%b${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:clean' format "${_prompt_ianonavy_colors[3]}✔${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:commit' format "${_prompt_ianonavy_colors[2]}%.7c${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:deleted' format "${_prompt_ianonavy_colors[6]}✖${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:modified' format "${_prompt_ianonavy_colors[7]}✱${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:renamed' format "${_prompt_ianonavy_colors[6]}➜${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:stashed' format "${_prompt_ianonavy_colors[7]}✭${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:unmerged' format "${_prompt_ianonavy_colors[7]}═${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:untracked' format "${_prompt_ianonavy_colors[6]}▪${_prompt_ianonavy_nocolor}"
|
|
zstyle ':prezto:module:git:info:keys' format \
|
|
'prompt' "${_prompt_ianonavy_colors[1]}%c%b%s${_prompt_ianonavy_colors[1]}∙%C%A%B%S%a%d%m%r%U%u${_prompt_ianonavy_colors[1]} " \
|
|
'rprompt' ''
|
|
|
|
# Set python-info parameters
|
|
zstyle ':prezto:module:python:info:virtualenv' format "${_prompt_ianonavy_colors[12]}%v${_prompt_ianonavy_nocolor} "
|
|
|
|
# Get the time
|
|
local time="${_prompt_ianonavy_colors[9]}%D{%H:%M} "
|
|
|
|
# Remote hosts change colors
|
|
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
|
local host="${_prompt_ianonavy_colors[8]}%m" #SSH
|
|
else
|
|
local host="${_prompt_ianonavy_colors[4]}%m" # no SSH
|
|
fi
|
|
|
|
local user="%(!.${_prompt_ianonavy_colors[6]}.${_prompt_ianonavy_colors[4]})%n${_prompt_ianonavy_colors[1]}@"
|
|
if [[ "$USER" == "ian" ]]; then
|
|
user=""
|
|
fi
|
|
local promptcolor='%(!.${_prompt_ianonavy_colors[6]}.${_prompt_ianonavy_nocolor})'
|
|
autoload -U colors && colors
|
|
|
|
# Define prompts.
|
|
PROMPT="
|
|
${_prompt_ianonavy_colors[1]}${user}${host}${_prompt_ianonavy_colors[1]} ${_prompt_ianonavy_colors[2]}%~ ${_prompt_ianonavy_colors[1]}$time${_prompt_ianonavy_colors[1]}"'$python_info[virtualenv]'""'${git_info[prompt]}'"
|
|
${promptcolor}"'${editor_info[keymap]}'"${_prompt_ianonavy_nocolor} "
|
|
RPROMPT='%{$fg[red]%}%(?..%? ↵)%{$reset_color%}'
|
|
SPROMPT='zsh: correct ${_prompt_ianonavy_colors[6]}%R${_prompt_ianonavy_nocolor} to ${_prompt_ianonavy_colors[4]}%r${_prompt_ianonavy_nocolor} [nyae]? '
|
|
}
|
|
|
|
prompt_ianonavy_setup "$@"
|