# # All information at your chilly fingertips. # # Authors: # Tom Frost # Ian Naval # # 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{green}" "${_prompt_ianonavy_nocolor}%F{red}" "${_prompt_ianonavy_nocolor}%F{yellow}" "${_prompt_ianonavy_nocolor}%F{magenta}" "${_prompt_ianonavy_nocolor}%F{white}" ) # Set editor-info params zstyle ':prezto:module:editor:info:completing' format '${_prompt_ianonavy_colors[3]}...${_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[4]}%s${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:added' format "${_prompt_ianonavy_colors[2]}✚${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:ahead' format "${_prompt_ianonavy_colors[4]}⚡${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:behind' format "${_prompt_ianonavy_colors[4]}↯${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:branch' format "${_prompt_ianonavy_colors[1]}∙${_prompt_ianonavy_colors[1]}%b${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:clean' format "${_prompt_ianonavy_colors[2]}✔${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:commit' format "${_prompt_ianonavy_colors[1]}%.7c${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:deleted' format "${_prompt_ianonavy_colors[3]}✖${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:modified' format "${_prompt_ianonavy_colors[4]}✱${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:renamed' format "${_prompt_ianonavy_colors[3]}➜${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:stashed' format "${_prompt_ianonavy_colors[4]}✭${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:unmerged' format "${_prompt_ianonavy_colors[4]}═${_prompt_ianonavy_nocolor}" zstyle ':prezto:module:git:info:untracked' format "${_prompt_ianonavy_colors[3]}▪${_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[6]}%v${_prompt_ianonavy_nocolor} " # Get the time local time="${_prompt_ianonavy_colors[5]}%D{%H:%M} " # Remote hosts change colors if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then local host="${_prompt_ianonavy_colors[4]}%m" #SSH else local host="${_prompt_ianonavy_colors[2]}%m" # no SSH fi local user="%(!.${_prompt_ianonavy_colors[3]}.${_prompt_ianonavy_colors[2]})%n${_prompt_ianonavy_colors[1]}@" if [[ "$USER" == "ian" ]]; then user="" fi local current_path="${_prompt_ianonavy_colors[1]}%~" local promptcolor='%(!.${_prompt_ianonavy_colors[3]}.${_prompt_ianonavy_nocolor})' autoload -U colors && colors # Define prompts. PROMPT=" ${user}${host} ${current_path} $time${_prompt_ianonavy_colors[1]}"'${python_info[virtualenv]}'""'${git_info[prompt]}'""%(?..${_prompt_ianonavy_colors[3]}%? ↵%f)" ${promptcolor}"'${editor_info[keymap]}'"${_prompt_ianonavy_nocolor} " RPROMPT='' SPROMPT='zsh: correct ${_prompt_ianonavy_colors[3]}%R${_prompt_ianonavy_nocolor} to ${_prompt_ianonavy_colors[2]}%r${_prompt_ianonavy_nocolor} [nyae]? ' } prompt_ianonavy_setup "${_prompt_ianonavy_colors[3]}$@"