Skip to content

Instantly share code, notes, and snippets.

@citizen428
Created May 21, 2015 03:45
Show Gist options
  • Save citizen428/7316f3e11004eabbd269 to your computer and use it in GitHub Desktop.
Save citizen428/7316f3e11004eabbd269 to your computer and use it in GitHub Desktop.
#
# A colorful, friendly, multiline theme with some handy features.
# Based on the 'giddie' theme by Paul Gideon Dann.
#
# Authors:
# Michael Kohl <citizen428@gmail.com>
# Paul Gideon Dann <pd@gmail.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Features:
# - Simple VCS branch, staged, and unstaged indication.
# - Last command exit status is displayed in RPROMPT when non-zero.
#
# Screenshots:
#
#
function +vi-git_precmd {
# Check for untracked files, since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
hook_com[unstaged]+='%F{red}●%f'
fi
}
function prompt_citizen428_precmd {
# Replace '/home/<user>' with '~'.
_prompt_citizen428_pwd="${PWD/#$HOME/~}"
ruby-info
vcs_info
}
function prompt_citizen428_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
# Add hook to set up prompt parameters before each command.
add-zsh-hook precmd prompt_citizen428_precmd
# Set vcs_info parameters.
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats '[%b%c%u]'
zstyle ':vcs_info:*' actionformats '[%b%c%u %F{magenta}(%a)%f]'
zstyle ':vcs_info:*' stagedstr '%F{green}●%f'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f'
# Set vcs_info hooks.
# NOTE: Prior to Zsh v4.3.12, there are no static hooks, no vcs_info_hookadd
# function, and no 'no-vcs' hook.
zstyle ':vcs_info:git*+set-message:*' git_precmd
# Set ruby-info parameters
zstyle ':prezto:module:ruby:info:version' format '%v'
# Define prompts.
PROMPT='%(?..%F{red}%B[✘] %b%f)%F{green}%n@%m%f %F{blue}[${_prompt_citizen428_pwd}]%f %F{red}[$ruby_info[version]]%f %F{yellow}${vcs_info_msg_0_}%f
%F{white}→%f '
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
}
prompt_citizen428_setup "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment