Created
May 21, 2015 03:45
-
-
Save citizen428/7316f3e11004eabbd269 to your computer and use it in GitHub Desktop.
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
# | |
# A colorful, friendly, multiline theme with some handy features. | |
# Based on the 'giddie' theme by Paul Gideon Dann. | |
# | |
# Authors: | |
# Michael Kohl <[email protected]> | |
# Paul Gideon Dann <[email protected]> | |
# Sorin Ionescu <[email protected]> | |
# | |
# 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