forked from sorin-ionescu/prezto
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix sorin-ionescu#260] Add peepcode theme
- Loading branch information
Sorin Ionescu
committed
Sep 7, 2012
1 parent
d1570ef
commit 3e2119c
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# A simple theme from PeepCode. | ||
# http://peepcode.com/blog/2012/my-command-line-prompt | ||
# | ||
# Authors: | ||
# Geoffrey Grosenbach <[email protected]> | ||
# Sorin Ionescu <[email protected]> | ||
# | ||
# Screenshots: | ||
# http://i.imgur.com/LhgmW.png | ||
# | ||
|
||
function +vi-git-status() { | ||
# Check for untracked files or updated submodules since vcs_info does not. | ||
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then | ||
hook_com[unstaged]='%F{8}✗%f' | ||
fi | ||
} | ||
|
||
function prompt_peepcode_precmd { | ||
vcs_info | ||
|
||
if (( $+functions[ruby-info] )); then | ||
ruby-info | ||
fi | ||
} | ||
|
||
function prompt_peepcode_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_peepcode_precmd | ||
|
||
# Set vcs_info parameters. | ||
zstyle ':vcs_info:*' enable git | ||
zstyle ':vcs_info:*' check-for-changes true | ||
zstyle ':vcs_info:*' get-revision true | ||
zstyle ':vcs_info:*' use-simple true | ||
zstyle ':vcs_info:*' unstagedstr '%F{8}✗%f' | ||
zstyle ':vcs_info:*' formats ' %F{8}%b%f %F{white}%.7i%f %u' | ||
zstyle ':vcs_info:*' actionformats ' %F{8}%b%f %F{white}%.7i%f +%a %u' | ||
zstyle ':vcs_info:git*+set-message:*' hooks git-status | ||
|
||
# Set ruby-info parameters. | ||
zstyle ':prezto:module:ruby' version ' %F{white}%v%f' | ||
|
||
# Define prompts. | ||
PROMPT=' | ||
%~ | ||
%(?.%F{green}☻%f.%F{red}☻%f) ' | ||
RPROMPT='${ruby_info[version]}${vcs_info_msg_0_}' | ||
|
||
} | ||
|
||
prompt_peepcode_setup "$@" | ||
|