Merge branch 'plugin-git' into merge

Conflicts:
	custom/aliases.zsh
	plugins/git/git-aliases.plugin.zsh
	plugins/git/git-prompt-old.plugin.zsh
	plugins/git/git-prompt.plugin.zsh
	plugins/git/git.plugin.zsh
	themes/ashleydev.zsh-theme
This commit is contained in:
Ashley Dev 2011-07-06 19:27:07 -07:00
commit 415bdbfe6d
135 changed files with 2170 additions and 1523 deletions

View file

@ -6,13 +6,6 @@ h2. Setup
@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. @oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9.
h3. The automatic installer... (do you trust me?)
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
h3. The manual way
1. Clone the repository 1. Clone the repository
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
@ -47,25 +40,16 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
h3. Customization h3. Customization
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugins/@ directory and then enable this plugin.
If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.
h3. Uninstalling
If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).
h2. Help out! h2. Help out!
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
h3. Send us your theme!
I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.
h2. Contributors h2. Contributors
This project wouldn't exist without all of our awesome users and contributors. This project wouldn't exist without all of our awesome users and contributors.
* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
Thank you so much! Thank you so much!

View file

@ -1,84 +0,0 @@
# The 'ls' family
# ------------------------------------------------------------------------------
[[ "$DISABLE_COLOR" != 'true' ]] && {
[[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true'
}
[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors)
[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1
[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad"
# add colors for filetype recognition
[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto'
[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F'
alias la='ls -Ahl' # show hidden files
alias lx='ls -lhXB' # sort by extension
alias lk='ls -lhSr' # sort by size, biggest last
alias lc='ls -lhtcr' # sort by and show change time, most recent last
alias lu='ls -lhtur' # sort by and show access time, most recent last
alias lt='ls -lhtr' # sort by date, most recent last
alias lm='ls -ahl | more' # pipe through 'more'
alias lr='ls -lhR' # recursive ls
alias l='ls -lha'
alias ll='ls -lh'
# General
# ------------------------------------------------------------------------------
alias rm='nocorrect rm -i'
alias cp='nocorrect cp -i'
alias mv='nocorrect mv -i'
alias ln='nocorrect ln -i'
alias mkdir='nocorrect mkdir -p'
alias du='du -kh'
alias df='df -kh'
alias e="$EDITOR"
alias get='curl -C - -O'
alias q='exit'
alias ssh='ssh -X'
alias h='history'
alias j='jobs -l'
alias f='fg'
alias gr='grep -r'
alias type='type -a'
alias print-path='echo -e ${PATH//:/\\n}'
alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
alias lsbom='lsbom -f -l -s -pf'
alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty"
alias v.='vim .'
alias v='vim ~/.vimrc'
alias VS='vim -S Session.vim'
alias z='vim -o ~/.zshenv ~/.oh-my-zsh/custom/aliases.zsh ~/.zshrc'
alias zs='source ~/.zshrc'
if [[ -x "${commands[htop]}" ]]; then
alias top=htop
else
alias topm='top -o vsize'
alias topc='top -o cpu'
fi
[[ "$DISABLE_COLOR" != 'true' ]] && {
[[ -x "${commands[colordiff]}" ]] && alias diff='colordiff'
[[ -x "${commands[colormake]}" ]] && alias make='colormake'
}
# Screen
# ------------------------------------------------------------------------------
[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'"
[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'"
alias screen="screen $screenrc"
alias sl="screen $screenrc -list"
alias sr="screen $screenrc -a -A -U -D -R"
alias S="screen $screenrc -U -S"
# TMUX
# ------------------------------------------------------------------------------
[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'"
[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'"
alias tmux="tmux $tmuxconf"
alias tls="tmux list-sessions"

View file

@ -1 +0,0 @@
unsetopt auto_pushd

View file

@ -1,47 +0,0 @@
function cdll() {
if [[ -n "$1" ]]; then
builtin cd "$1"
ls -lFhA
else
ls -lFhA
fi
}
function pushdll() {
if [[ -n "$1" ]]; then
builtin pushd "$1"
ls -lFhA
else
ls -lFhA
fi
}
function popdll() {
builtin popd
ls -lFhA
}
function grab() {
sudo chown -R ${USER} ${1:-.}
}
function reload() {
source "$HOME/.zshrc"
}
function calc() {
echo "scale=4; $@" | bc -l
}
function pmine() {
ps $@ -u $USER -o pid,%cpu,%mem,command
}
function findexec() {
find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \;
}
function httpserve() {
python -m SimpleHTTPServer
}

View file

@ -1,8 +0,0 @@
if [[ "$DISABLE_COLOR" != "true" ]]; then
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='37;45'
else
export GREP_OPTIONS='--color=none'
export GREP_COLOR=''
fi

View file

@ -1,4 +0,0 @@
if [[ "$DISABLE_COLOR" == "true" ]]; then
F_ordinary_highlight="bg=none,fg=none"
F_out_of_matches_highlight="bg=none,fg=none"
fi

View file

@ -1,5 +0,0 @@
# Add yourself some shortcuts to projects you often work on
# Example:
#
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
#

View file

@ -1,24 +1,112 @@
# Push and pop directories on directory stack # The 'ls' family
# ------------------------------------------------------------------------------
if [[ "$DISABLE_COLOR" != 'true' ]]; then
if (( ${+commands[dircolors]} )); then
dircolors="${commands[dircolors]}"
fi
if (( ${+commands[gdircolors]} )); then
dircolors="${commands[gdircolors]}"
fi
if [[ -x "$dircolors" ]] && [[ -e "$HOME/.dir_colors" ]]; then
eval $("$dircolors" "$HOME/.dir_colors")
alias ls='ls -hF --group-directories-first --color=auto'
else
export CLICOLOR=1
export LSCOLORS="exfxcxdxbxegedabagacad"
alias ls='ls -G -F'
fi
fi
alias ll='ls -lh' # Show human readable.
alias l='ls -lha' # Show hidden files.
alias la='ls -lhA' # Show hidden files.
alias lx='ls -lhXB' # Sort by extension.
alias lk='ls -lhSr' # Sort by size, biggest last.
alias lc='ls -lhtcr' # Sort by and show change time, most recent lasa.
alias lu='ls -lhtur' # Sort by and show access time, most recent last.
alias lt='ls -lhtr' # Sort by date, most recent last.
alias lm='ls -lha | more' # Pipe through 'more'.
alias lr='ls -lhR' # Recursive ls.
# General
# ------------------------------------------------------------------------------
alias rm='nocorrect rm -i'
alias cp='nocorrect cp -i'
alias mv='nocorrect mv -i'
alias ln='nocorrect ln -i'
alias mkdir='nocorrect mkdir -p'
alias du='du -kh'
alias df='df -kh'
alias pu='pushd' alias pu='pushd'
alias po='popd' alias po='popd'
# Basic directory operations
alias ...='cd ../..'
alias -- -='cd -'
# Super user
alias _='sudo' alias _='sudo'
alias e="$EDITOR"
#alias g='grep -in'
# Show history
alias history='fc -l 1' alias history='fc -l 1'
alias get='curl -C - -O'
alias q='exit'
alias ssh='ssh -X'
alias h='history'
alias j='jobs -l'
alias f='fg'
alias gr='grep -r'
alias afind='ack -il'
alias type='type -a'
# alias ssh='ssh -X'
alias print-path='echo -e ${PATH//:/\\n}'
alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty"
# List direcory contents alias z='vim -o ~/.zshenv ~/.oh-my-zsh/lib/aliases.zsh ~/.zshrc'
alias lsa='ls -lah' alias zs='source ~/.zshrc'
alias l='ls -la'
alias ll='ls -l'
alias sl=ls # often screw this up
alias afind='ack-grep -il' if [[ "$EDITOR" = vi* ]]; then
alias v.='vim .'
alias v='vim ~/.vimrc'
alias VS='vim -S Session.vim'
fi
if [[ -x "${commands[htop]}" ]]; then
alias top=htop
else
alias topm='top -o vsize'
alias topc='top -o cpu'
fi
if [[ "$DISABLE_COLOR" != 'true' ]]; then
if [[ -x "${commands[colordiff]}" ]]; then
alias diff='colordiff'
fi
if [[ -x "${commands[colormake]}" ]]; then
alias make='colormake'
fi
fi
# Terminal Multiplexer
# ------------------------------------------------------------------------------
local screenrc tmuxconf
if [[ "$TERM" == 'xterm-color' ]]; then
if [[ -e "$HOME/.screenrc" ]]; then
screenrc="-c '$HOME/.screenrc'"
fi
if [[ -e "$HOME/.tmux.conf" ]]; then
tmuxconf="-f '$HOME/.tmux.conf'"
fi
fi
if [[ "$TERM" == 'xterm-256color' ]]; then
if [[ -e "$HOME/.screenrc256" ]]; then
screenrc="-c '$HOME/.screenrc256'"
fi
if [[ -e "$HOME/.tmux256.conf" ]]; then
tmuxconf="-f '$HOME/.tmux256.conf'"
fi
fi
alias screen="screen $screenrc"
alias sl="screen $screenrc -list"
alias sr="screen $screenrc -a -A -U -D -R"
alias S="screen $screenrc -U -S"
alias tmux="tmux $tmuxconf"
alias tls="tmux list-sessions"

View file

@ -1,19 +1,21 @@
# fixme - the load process here seems a bit bizarre # Dumb terminals lack support.
[[ "$TERM" == "dumb" ]] && return if [[ "$TERM" == 'dumb' ]]; then
return
fi
unsetopt menu_complete # do not autoselect the first completion entry unsetopt menu_complete # Do not autoselect the first completion entry.
unsetopt flowcontrol unsetopt flow_control # Disable start/stop characters in shell editor.
setopt auto_menu # show completion menu on succesive tab press setopt auto_menu # Show completion menu on a succesive tab press.
setopt complete_in_word setopt complete_in_word # Complete from both ends of a word.
setopt always_to_end setopt always_to_end # Move cursor to the end of a completed word.
WORDCHARS='' WORDCHARS=''
# fixme - complist is crashing ZSH on menu completion # FIXME: complist is crashing ZSH on menu completion.
# zmodload -i zsh/complist # zmodload -i zsh/complist
## case-insensitive (all),partial-word and then substring completion ## Case-insensitive (all), partial-word, and then substring completion.
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then if [[ "$CASE_SENSITIVE" == "true" ]]; then
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE unset CASE_SENSITIVE
else else
@ -22,18 +24,19 @@ fi
zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors ''
# should this be in keybindings? # FIXME: It depends on complist which crashes ZSH on menu completion.
# Should this be in key-bindings.zsh?
# bindkey -M menuselect '^o' accept-and-infer-next-history # bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
# disable named-directories autocompletion # Disable named-directories autocompletion.
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
cdpath=(.) cdpath=(.)
# use /etc/hosts and known_hosts for hostname completion # Use /etc/hosts and known_hosts for hostname completion.
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=() [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=( hosts=(
@ -44,11 +47,11 @@ hosts=(
) )
zstyle ':completion:*:hosts' hosts $hosts zstyle ':completion:*:hosts' hosts $hosts
# Use caching so that commands like apt and dpkg complete are useable # Use caching to make completion for cammands such as dpkg and apt usable.
zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/ zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
# Don't complete uninteresting users # Don't complete uninteresting users...
zstyle ':completion:*:*:*:users' ignored-patterns \ zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \

View file

@ -8,3 +8,4 @@ alias gist='nocorrect gist'
alias heroku='nocorrect heroku' alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild' alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder' alias hpodder='nocorrect hpodder'

View file

@ -1,7 +1,9 @@
# Changing/making/removing directory setopt auto_cd # Auto cd to a directory without typing cd.
setopt auto_name_dirs setopt auto_pushd # Push the old directory onto the stack on cd.
setopt auto_pushd setopt pushd_ignore_dups # Don't store duplicates in the stack.
setopt pushd_ignore_dups setopt cdable_vars # Change directory to a path stored in a variable.
setopt auto_name_dirs # Auto add variable-stored paths to ~ list.
setopt multios # Write to multiple descriptors.
alias ..='cd ..' alias ..='cd ..'
alias cd..='cd ..' alias cd..='cd ..'
@ -9,6 +11,7 @@ alias cd...='cd ../..'
alias cd....='cd ../../..' alias cd....='cd ../../..'
alias cd.....='cd ../../../..' alias cd.....='cd ../../../..'
alias cd/='cd /' alias cd/='cd /'
alias -- -='cd -'
alias 1='cd -' alias 1='cd -'
alias 2='cd +2' alias 2='cd +2'
@ -34,11 +37,3 @@ cd () {
fi fi
} }
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v'
# mkdir & cd to it
function mcd() {
mkdir -p "$1" && cd "$1";
}

View file

@ -1,17 +1,60 @@
function zsh_stats() { function history-stat() {
history | awk '{print $2}' | sort | uniq -c | sort -rn | head history | awk '{print $2}' | sort | uniq -c | sort -rn | head
} }
function uninstall_oh_my_zsh() { function mkdcd() {
/bin/sh $ZSH/tools/uninstall.sh mkdir -p "$1"
cd "$1"
} }
function upgrade_oh_my_zsh() { function cdll() {
/bin/sh $ZSH/tools/upgrade.sh if [[ -n "$1" ]]; then
builtin cd "$1"
ls -lFhA
else
ls -lFhA
fi
} }
function take() { function pushdll() {
mkdir -p $1 if [[ -n "$1" ]]; then
cd $1 builtin pushd "$1"
ls -lFhA
else
ls -lFhA
fi
}
function popdll() {
builtin popd
ls -lFhA
}
function gown() {
sudo chown -R "${USER}" "${1:-.}"
}
function reload() {
local zshrc="$HOME/.zshrc"
if [[ -n "$1" ]]; then
zshrc="$1"
fi
source "$zshrc"
}
function calc() {
echo "scale=4; $@" | bc -l
}
function pmine() {
ps "$@" -u "$USER" -o pid,%cpu,%mem,command
}
function findexec() {
find . -type f -iname "*${1:-}*" -exec "${2:-file}" {} \;
}
function httpserve() {
python -m SimpleHTTPServer "$@"
} }

View file

@ -1,4 +1,12 @@
if [[ "$DISABLE_COLOR" != "true" ]]; then if [[ "$DISABLE_COLOR" != 'true' ]]; then
[[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' if [[ -z "$GREP_OPTIONS" ]]; then
[[ -z "$GREP_COLOR" ]] && export GREP_COLOR='1;32' export GREP_OPTIONS='--color=auto'
fi
if [[ -z "$GREP_COLOR" ]]; then
export GREP_COLOR="1;32"
fi
else
export GREP_OPTIONS='--color=none'
export GREP_COLOR=''
fi fi

View file

@ -1,13 +1,14 @@
## Command history configuration ## Command history configuration
HISTFILE=$HOME/.zsh_history HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000 HISTSIZE=10000
SAVEHIST=10000 SAVEHIST=10000
setopt HIST_VERIFY setopt hist_verify
setopt HIST_EXPIRE_DUPS_FIRST setopt hist_expire_dups_first
setopt HIST_IGNORE_SPACE setopt hist_ignore_space
setopt HIST_IGNORE_DUPS setopt hist_ignore_dups
setopt SHARE_HISTORY setopt share_history
setopt APPEND_HISTORY setopt append_history
setopt EXTENDED_HISTORY setopt extended_history
setopt INC_APPEND_HISTORY setopt inc_append_history

View file

@ -1,4 +1,4 @@
# TODO: Explain what some of this does.. # TODO: Write a GNU Emacs key bindings file akin to the vi-mode plugin.
bindkey -e bindkey -e
bindkey '\ew' kill-region bindkey '\ew' kill-region
@ -8,7 +8,7 @@ bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff # Make key up/down move up/down or search history.
bindkey '^[[A' up-line-or-search bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search bindkey '^[[B' down-line-or-search
@ -16,18 +16,22 @@ bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line bindkey "^[[1~" beginning-of-line
bindkey "^[[F" end-of-line bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line bindkey "^[[4~" end-of-line
bindkey ' ' magic-space # also do history expansion on space
# Do history expansion on space.
bindkey ' ' magic-space
# File rename magick.
bindkey "^[m" copy-prev-shell-word
bindkey '^[[Z' reverse-menu-complete bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~.
bindkey "^[[3~" delete-char bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
# consider emacs keybindings: # Consider GNU Emacs keybindings:
#bindkey -e ## emacs key bindings #bindkey -e # Emacs key bindings.
# #
#bindkey '^[[A' up-line-or-search #bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search #bindkey '^[[B' down-line-or-search
@ -40,6 +44,6 @@ bindkey "\e[3~" delete-char
#bindkey '^X^N' accept-and-infer-next-history #bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region #bindkey '^W' kill-region
#bindkey '^I' complete-word #bindkey '^I' complete-word
## Fix weird sequence that rxvt produces ## FIXME: A weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t' #bindkey -s '^[[Z' '\t'
#

View file

@ -1,13 +1,17 @@
## smart urls # Smart URLs
autoload -U url-quote-magic autoload -U url-quote-magic
zle -N self-insert url-quote-magic zle -N self-insert url-quote-magic
## file rename magick # Jobs
bindkey "^[m" copy-prev-shell-word
## jobs
setopt long_list_jobs setopt long_list_jobs
## pager # Pager
[[ -z "$PAGER" ]] && export PAGER=less if [[ -z "$PAGER" ]]; then
[[ -z "$LC_CTYPE" ]] && export LC_CTYPE=en_US.UTF-8 export PAGER=less
fi
# Localization
if [[ -z "$LC_CTYPE" ]]; then
export LC_CTYPE=en_US.UTF-8
fi

View file

@ -1,7 +0,0 @@
# get the name of the branch we are on
function rvm_prompt_info() {
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
echo "($ruby_version)"
}

View file

@ -1,20 +1,20 @@
#! /bin/zsh # A script to make using 256 colors in ZSH less painful in your PROMPT.
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com> # P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG typeset -Ag FX FG BG
FX=( FX=(
reset "%{%}" reset "%{%}"
bold "%{%}" no-bold "%{%}" bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}" italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}" underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}" blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}" reverse "%{%}" no-reverse "%{%}"
) )
for color in {000..255}; do for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}" FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}" BG[$color]="%{[48;5;${color}m%}"
done done

View file

@ -1,31 +1,40 @@
[[ "$TERM" == "dumb" ]] && return # Dumb terminals lack support.
if [[ "$TERM" == 'dumb' ]]; then
return
fi
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title # Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals.
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 # Partially supports Mac OS X Terminal since it can't set window and tab separately.
#Fully support screen, iterm, and probably most modern xterm and rxvt # Usage: title "tab title" "window title"
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title { function title {
[ "$DISABLE_AUTO_TITLE" != "true" ] || return if [[ "$DISABLE_AUTO_TITLE" != 'true' ]]; then
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars # Set GNU Screen's hardstatus (usually truncated at 20 characters).
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\ek$1:q\e\\"
print -Pn "\e]2;$2:q\a" #set window name elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]]; then
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) # Set the window title.
print -Pn "\e]2;$2:q\a"
# Set the tab title (will override window title on a broken terminal).
print -Pn "\e]1;$1:q\a"
fi
fi fi
} }
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD # 15 character, left-truncated current working directory.
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<"
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
#Appears when you have the prompt # Set the tab and window titles before the prompt is displayed.
function precmd { function precmd {
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
} }
#Appears at the beginning of (and during) of command execution # Set the tab and window titles before command execution.
function preexec { function preexec {
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd # Command name only, or if this is sudo or ssh, the next command.
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
title "$CMD" "%100>...>$2%<<" title "$CMD" "%100>...>$2%<<"
} }

View file

@ -1,35 +1,23 @@
# ls colors # Load and run colors.
autoload colors; colors; autoload -U colors
[[ -z "$LSCOLORS" ]] && export LSCOLORS="Gxfxcxdxbxegedabagacad" colors -i
# Enable ls colors # Set the GNU Screen window number.
if [ "$DISABLE_COLOR" != "true" ] if [[ -n "$WINDOW" ]]; then
then SCREEN_NO="%B$WINDOW%b "
# Find the option for using colors in ls, depending on the version: Linux or BSD
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi
#setopt no_beep
setopt auto_cd
setopt multios
setopt cdablevarS
if [[ x$WINDOW != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else else
SCREEN_NO="" SCREEN_NO=""
fi fi
# Apply theming defaults # Set the default prompt theme.
PS1="%n@%m:%~%# " PS1="%n@%m:%~%# "
# git theming default: Variables for theming the git info prompt # Set the default Git prompt theme.
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name.
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name.
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to display if the branch is dirty.
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean ZSH_THEME_GIT_PROMPT_CLEAN="" # Indicator to display if the branch is clean.
# Setup the prompt with pretty colors # Enable parameter, arithmentic expansion and command substitution in prompt.
setopt prompt_subst setopt prompt_subst

View file

@ -1,4 +0,0 @@
This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it.
feel free to add love notes for people here.

View file

@ -1,58 +1,45 @@
# Initializes Oh My Zsh # Initializes OH MY ZSH.
# Disable colors on dumb terminals # Disable color in dumb terminals.
if [ "$TERM" = "dumb" ]; then if [[ "$TERM" == 'dumb' ]]; then
DISABLE_COLOR="true" DISABLE_COLOR='true'
fi fi
# add a function path # Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh.
fpath=($ZSH/functions $fpath) for config_file in $ZSH/lib/*.zsh; do
source "$config_file"
done
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Add all defined plugins to fpath.
# TIP: Add files you don't want in git to .gitignore
for config_file ($ZSH/lib/*.zsh) source $config_file
# Add all defined plugins to fpath
plugin=${plugin:=()} plugin=${plugin:=()}
for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) for plugin in $plugins; do
fpath=($ZSH/plugins/$plugin $fpath)
done
# Load and run compinit # Load and run compinit.
autoload -U compinit autoload -U compinit
compinit -i compinit -i
# Load all of the plugins that were defined in ~/.zshrc # Load all plugins defined in ~/.zshrc.
for plugin ($plugins); do for plugin in $plugins; do
if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then if [[ -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" ]]; then
source $ZSH/plugins/$plugin/$plugin.plugin.zsh source "$ZSH/plugins/$plugin/$plugin.plugin.zsh"
fi fi
done done
# Load the theme # Load the theme.
# Check for updates on initial load... if [[ "$ZSH_THEME" == "random" ]]; then
if [ "$ZSH_THEME" = "random" ] themes=($ZSH/themes/*.zsh-theme)
then theme_index=${#themes[@]}
themes=($ZSH/themes/*zsh-theme) (( theme_index=((RANDOM % theme_index) + 1) ))
N=${#themes[@]} random_theme="${themes[$theme_index]}"
((N=RANDOM%N)) source "$random_theme"
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else else
source "$ZSH/themes/$ZSH_THEME.zsh-theme" source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi fi
# Load all of your custom configurations from custom/
for config_file ($ZSH/custom/*.zsh) source $config_file
# Compile zcompdump, if modified, to increase startup speed. # Compile zcompdump, if modified, to increase startup speed.
if [ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" -o ! -e "$HOME/.zcompdump.zwc" ]; then if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -e "$HOME/.zcompdump.zwc" ]]; then
zcompile "$HOME/.zcompdump" zcompile "$HOME/.zcompdump"
fi fi
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" = "true" ]
then
return
else
/usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
fi

View file

@ -0,0 +1,26 @@
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%y)
fi
_ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0;
else
accurate=$($stat_cmd -f%m .ant_targets)
changed=$($stat_cmd -f%m build.xml)
return $(expr $accurate '>=' $changed)
fi
}
_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
fi
compadd `cat .ant_targets`
fi
}
compdef _ant ant

View file

@ -0,0 +1,3 @@
if [ -f `brew --prefix`/etc/autojump ]; then
. `brew --prefix`/etc/autojump
fi

View file

@ -25,10 +25,12 @@ _1st_arguments=(
'link:link a formula' 'link:link a formula'
'list:list files in a formula or not-installed formulae' 'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula' 'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
'outdated:list formulas for which a newer version is available' 'outdated:list formulas for which a newer version is available'
'prune:remove dead links' 'prune:remove dead links'
'remove:remove a formula' 'remove:remove a formula'
'search:search for a formula (/regex/ or string)' 'search:search for a formula (/regex/ or string)'
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'unlink:unlink a formula' 'unlink:unlink a formula'
'update:freshen up links' 'update:freshen up links'
'upgrade:upgrade outdated formulae' 'upgrade:upgrade outdated formulae'
@ -36,10 +38,14 @@ _1st_arguments=(
) )
local expl local expl
local -a formula installed_formulae local -a formulae installed_formulae
_arguments \ _arguments \
'(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--config)--config[brew configuration]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \ '(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \ '(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \ '(--cache)--cache[brew cache]' \
@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then
fi fi
case "$words[1]" in case "$words[1]" in
list) search|-S)
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
list|ls)
_arguments \ _arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'(--versions)--versions[list all installed versions of a formula]' \
'1: :->forms' && return 0 '1: :->forms' && return 0
if [[ "$state" == forms ]]; then if [[ "$state" == forms ]]; then
_brew_installed_formulae _brew_installed_formulae
_requested installed_formulae expl 'installed formulae' compadd -a installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;; fi ;;
install|home|log|info|uses|cat|deps) install|home|homepage|log|info|abv|uses|cat|deps|edit|options)
_brew_all_formulae _brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;; _wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|edit|xo) remove|rm|uninstall|unlink|cleanup|link|ln)
_brew_installed_formulae _brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
esac esac

View file

@ -18,4 +18,4 @@ function _cap () {
fi fi
} }
compctl -K _cap cap compctl -K _cap cap

View file

@ -5,10 +5,9 @@
# VERSION: 1.0.0 # VERSION: 1.0.0
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if (( ${+commands[compleat]} )); then if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}" local prefix="${commands[compleat]:h:h}"
local setup="${prefix}/share/compleat-1.0/compleat_setup" local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then if [[ -f "$setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then if ! bashcompinit >/dev/null 2>&1; then
@ -16,7 +15,6 @@ if (( ${+commands[compleat]} )); then
bashcompinit -i bashcompinit -i
fi fi
source "$setup" source "$setup"
fi fi
fi fi

View file

@ -1,9 +1,9 @@
#!/bin/zsh #!/bin/zsh
# #
# Make the dirstack more persistant # Make the dirstack more persistant
# #
# Add dirpersist to $plugins in ~/.zshrc to load # Add dirpersist to $plugins in ~/.zshrc to load
# #
# $zdirstore is the file used to persist the stack # $zdirstore is the file used to persist the stack
zdirstore=~/.zdirstore zdirstore=~/.zdirstore

View file

@ -23,7 +23,7 @@ function extract() {
remove_archive=1 remove_archive=1
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
remove_archive=0 remove_archive=0
shift shift
fi fi
@ -64,10 +64,10 @@ function extract() {
cd ..; rm *.tar.gz debian-binary cd ..; rm *.tar.gz debian-binary
cd .. cd ..
;; ;;
(*) (*)
echo "extract: '$1' cannot be extracted" 1>&2 echo "extract: '$1' cannot be extracted" 1>&2
success=1 success=1
;; ;;
esac esac
(( success = $success > 0 ? $success : $? )) (( success = $success > 0 ? $success : $? ))

View file

@ -329,4 +329,4 @@ __git_command_successful () {
return 0 return 0
} }
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'

View file

@ -131,7 +131,7 @@ _git-archive () {
'--format=-[format of the resulting archive]:archive format:__git_archive_formats' \ '--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
'(- :)'{-l,--list}'[list available archive formats]' \ '(- :)'{-l,--list}'[list available archive formats]' \
'(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \ '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
'--prefix=-[prepend the given path prefix to to each filename]:path prefix:_directories -r ""' \ '--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
'--output=[write archive to argument instead of stdout]:archive:_files' \ '--output=[write archive to argument instead of stdout]:archive:_files' \
'--worktree-attributes[look for attributes in .gitattributes in working directory too]' \ '--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
$backend_args \ $backend_args \
@ -258,16 +258,22 @@ _git-branch () {
d='-d -D' d='-d -D'
declare -a dependent_creation_args declare -a dependent_creation_args
dependent_creation_args=( if (( words[(I)-r] == 0 )); then
"($l $m $d): :__git_branch_names" dependent_creation_args=(
"::start-point:__git_revisions") "($l $m $d): :__git_branch_names"
"::start-point:__git_revisions")
fi
declare -a dependent_deletion_args declare -a dependent_deletion_args
if (( words[(I)-d] || words[(I)-D] )); then if (( words[(I)-d] || words[(I)-D] )); then
dependent_creation_args= dependent_creation_args=
dependent_deletion_args=( dependent_deletion_args=(
'-r[delete remote-tracking branches]' '-r[delete only remote-tracking branches]')
'*: :__git_ignore_line_inside_arguments __git_branch_names') if (( words[(I)-r] )); then
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
else
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
fi
fi fi
declare -a dependent_modification_args declare -a dependent_modification_args
@ -281,7 +287,7 @@ _git-branch () {
_arguments -w -S -s \ _arguments -w -S -s \
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
"($c $m $d : --color)--no-color[turn off branch coloring]" \ "($c $m $d : --color)--no-color[turn off branch coloring]" \
"($c $m $d : -a)-r[list only the remote-tracking branches]" \ "($c $m -a)-r[list or delete only remote-tracking branches]" \
"($c $m $d : -r)-a[list both remote-tracking branches and local branches]" \ "($c $m $d : -r)-a[list both remote-tracking branches and local branches]" \
"($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \ "($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
@ -2941,7 +2947,7 @@ _git-rev-parse () {
else else
# TODO: Parse option specification? # TODO: Parse option specification?
_arguments -w -S -s \ _arguments -w -S -s \
'(- *)'{-h,--help}'[display usage]' '(- *)'{-h,--help}'[display usage]' \
'--keep-dashdash[do not skip first -- option]' \ '--keep-dashdash[do not skip first -- option]' \
'--stop-at-non-option[stop parsing options at first non-option argument]' \ '--stop-at-non-option[stop parsing options at first non-option argument]' \
'*:option specification' && ret=0 '*:option specification' && ret=0
@ -3958,7 +3964,7 @@ _git-name-rev () {
'--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \ '--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \
'(--stdin :)--all[list all commits reachable from all refs]' \ '(--stdin :)--all[list all commits reachable from all refs]' \
'(--all :)--stdin[read from stdin and append revision-name]' \ '(--all :)--stdin[read from stdin and append revision-name]' \
'--name-only[display only name of commits]' '--name-only[display only name of commits]' \
'--no-undefined[die with non-zero return when a reference is undefined]' \ '--no-undefined[die with non-zero return when a reference is undefined]' \
'--always[show uniquely abbreviated commit object as fallback]' \ '--always[show uniquely abbreviated commit object as fallback]' \
'(--stdin --all)*: :__git_commits' && ret=0 '(--stdin --all)*: :__git_commits' && ret=0
@ -4919,7 +4925,7 @@ __git_remote_branch_names () {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='%(refname)' refs/remotes 2>/dev/null)"}#refs/remotes/}) branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/})
__git_command_successful $pipestatus || return __git_command_successful $pipestatus || return
_wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
@ -5162,7 +5168,7 @@ __git_files_relative () {
files=() files=()
# Collapse "//" and "/./" into "/". Strip any remaining "/." and "/". # Collapse “//” and “/./” into “/”. Strip any remaining “/.” and “/”.
for file in ${${${${${(0)1}//\/\///}//\/.\///}%/.}%/}; do for file in ${${${${${(0)1}//\/\///}//\/.\///}%/.}%/}; do
integer i n integer i n
(( n = $#file > $#prefix ? $#file : $#prefix )) (( n = $#file > $#prefix ? $#file : $#prefix ))
@ -5413,6 +5419,10 @@ __git_guard_diff-stat-width () {
(( $+functions[__git_guard_number] )) || (( $+functions[__git_guard_number] )) ||
__git_guard_number () { __git_guard_number () {
declare -A opts
zparseopts -K -D -A opts M: J: V: 1 2 n F: X:
_guard "[[:digit:]]#" ${1:-number} _guard "[[:digit:]]#" ${1:-number}
} }

View file

@ -1,5 +1,5 @@
# Aliases # Aliases
alias g='git' ; compdef g=git # alias g='git' ; compdef g=git
alias ga='git add' ; compdef _git ga=git-add alias ga='git add' ; compdef _git ga=git-add
alias gaa='git add --all' ; compdef _git gaa=git-add alias gaa='git add --all' ; compdef _git gaa=git-add
alias gs='git status' ; compdef _git gs=git-status alias gs='git status' ; compdef _git gs=git-status
@ -25,6 +25,7 @@ alias gcount='git shortlog -sn' ; compdef gcount=git
alias gcp='git cherry-pick' ; compdef _git gcp=git-cherry-pick alias gcp='git cherry-pick' ; compdef _git gcp=git-cherry-pick
alias gm='git merge' ; compdef _git gm=git-merge alias gm='git merge' ; compdef _git gm=git-merge
alias glg='git log --stat --max-count=5'; compdef _git glg=git-log alias glg='git log --stat --max-count=5'; compdef _git glg=git-log
alias gls='git shortlog' ; compdef _git gls=shortlog
# Git history (pretty) # Git history (pretty)
local pretty_format_oneline='--pretty=format:"%C(yellow)%h %C(green)%cd %C(cyan)%an %C(bold cyan)%d%C(reset) %s" --date=short' local pretty_format_oneline='--pretty=format:"%C(yellow)%h %C(green)%cd %C(cyan)%an %C(bold cyan)%d%C(reset) %s" --date=short'

View file

@ -1,79 +0,0 @@
# Renders the name of the current branch.
function git_prompt_info() {
local branch=$(git_current_branch)
if [[ -n "$branch" ]]; then
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
fi
}
# Gets the current branch.
function git_current_branch() {
local ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n "$ref" ]]; then
echo "${ref#refs/heads/}"
fi
}
# Checks if the working tree is dirty.
function parse_git_dirty() {
if [[ -n $(git status -s 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
# Checks if there are commits ahead from remote.
function git_prompt_ahead() {
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
}
# Formats the prompt string for current git commit short SHA.
function git_prompt_short_sha() {
local sha=$(git rev-parse --short HEAD 2> /dev/null)
if [[ -n "$sha" ]]; then
echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}"
fi
}
# Formats the prompt string for current git commit long SHA.
function git_prompt_long_sha() {
local sha=$(git rev-parse HEAD 2> /dev/null)
if [[ -n "$sha" ]]; then
echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}"
fi
}
# Gets the status of the working tree.
function git_prompt_status() {
local indicators line untracked added modified renamed deleted
while IFS=$'\n' read line; do
if [[ "$line" =~ '^\?\? ' ]]; then
[[ -n $untracked ]] && continue || untracked='yes'
indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}"
fi
if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then
[[ -n $added ]] && continue || added='yes'
indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}"
fi
if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then
[[ -n $modified ]] && continue || modified='yes'
indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}"
fi
if [[ "$line" =~ '^R ' ]]; then
[[ -n $renamed ]] && continue || renamed='yes'
indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}"
fi
if [[ "$line" =~ '^( D|AD) ' ]]; then
[[ -n $deleted ]] && continue || deleted='yes'
indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}"
fi
if [[ "$line" =~ '^UU ' ]]; then
[[ -n $unmerged ]] && continue || unmerged='yes'
indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}"
fi
done < <(git status --porcelain 2> /dev/null)
echo $indicators
}

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,2 @@
source $ZSH/plugins/git/git-aliases.plugin.zsh source $ZSH/plugins/git/git-aliases.plugin.zsh
source $ZSH/plugins/git/git-prompt-old.plugin.zsh
source $ZSH/plugins/git/git-prompt.plugin.zsh source $ZSH/plugins/git/git-prompt.plugin.zsh

View file

@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then
# eval `hub alias -s zsh` # eval `hub alias -s zsh`
function git(){hub "$@"} function git(){hub "$@"}
fi fi

View file

@ -6,7 +6,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if [[ -x "${commands[gwhoami]}" ]]; then if [[ -x "${commands[gwhoami]}" ]]; then
__gnu_utils() { __gnu_utils() {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
@ -14,7 +14,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then
local cmd local cmd
local prefix local prefix
# coreutils # coreutils
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod' gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate' 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand' 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
@ -35,7 +35,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then
for gcmd in "${gcmds[@]}"; do for gcmd in "${gcmds[@]}"; do
# #
# This method allows for builtin commands to be primary but it's # This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash -f is executed. Thus, those two # lost if hash -r or rehash -f is executed. Thus, those two
# functions have to be wrapped. # functions have to be wrapped.
# #
(( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]} (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}

View file

@ -0,0 +1,26 @@
# Based on ssh-agent code
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
function start_agent {
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null
chmod 600 ${GPG_ENV}
. ${GPG_ENV} > /dev/null
}
# Source GPG agent settings, if applicable
if [ -f "${GPG_ENV}" ]; then
. ${GPG_ENV} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || {
start_agent;
}
else
start_agent;
fi
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
GPG_TTY=$(tty)
export GPG_TTY

View file

@ -1,6 +1,6 @@
#compdef port #compdef port
local subcmds local subcmds
# we cache the list of ports # we cache the list of ports
# we shall use some cache policy to avoid problems with new ports # we shall use some cache policy to avoid problems with new ports
@ -31,8 +31,8 @@ subcmds=(
'file' 'file'
'help' 'help'
'info' 'info'
'install' 'install'
'installed' 'installed'
'list' 'list'
'livecheck' 'livecheck'
'location' 'location'
@ -48,7 +48,7 @@ subcmds=(
'test' 'test'
'unarchive' 'unarchive'
'uninstall' 'uninstall'
'upgrade' 'upgrade'
'variants' 'variants'
'version' 'version'
) )

View file

@ -0,0 +1,5 @@
# Open the node api for your current version to the optional section.
# TODO: Make the section part easier to use.
function node-docs {
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
}

View file

@ -44,7 +44,7 @@ EOF
} }
function pfd() { function pfd() {
osascript 2>/dev/null <<EOF osascript 2>/dev/null <<EOF
tell application "Finder" tell application "Finder"
return POSIX path of (target of window 1 as alias) return POSIX path of (target of window 1 as alias)
end tell end tell
@ -52,14 +52,14 @@ EOF
} }
function pfs() { function pfs() {
osascript 2>/dev/null <<EOF osascript 2>/dev/null <<EOF
set output to "" set output to ""
tell application "Finder" to set the_selection to selection tell application "Finder" to set the_selection to selection
set item_count to count the_selection set item_count to count the_selection
repeat with item_index from 1 to count the_selection repeat with item_index from 1 to count the_selection
if item_index is less than item_count then set the_delimiter to "\n" if item_index is less than item_count then set the_delimiter to "\n"
if item_index is item_count then set the_delimiter to "" if item_index is item_count then set the_delimiter to ""
set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter set output to output & ((item item_index of the_selection as alias)'s POSIX path) & the_delimiter
end repeat end repeat
EOF EOF
} }

View file

@ -27,7 +27,7 @@ alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/pe
# Functions ################################################################# # Functions #################################################################
# newpl - creates a basic Perl script file and opens it with $EDITOR # newpl - creates a basic Perl script file and opens it with $EDITOR
newpl () { newpl () {
# set $EDITOR to 'vim' if it is undefined # set $EDITOR to 'vim' if it is undefined
[[ -z $EDITOR ]] && EDITOR=vim [[ -z $EDITOR ]] && EDITOR=vim

View file

@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () {
_phing () { _phing () {
if [ -f build.xml ]; then if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then if _phing_does_target_list_need_generating; then
echo "\nGenerating .phing_targets..." > /dev/stderr
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets
fi fi
compadd `cat .phing_targets` compadd `cat .phing_targets`

View file

@ -0,0 +1,10 @@
# Thanks to Christopher Sexton
# https://gist.github.com/965032
function kapow {
touch ~/.pow/$1/tmp/restart.txt
if [ $? -eq 0 ]; then
echo "$fg[yellow]Pow restarting $1...$reset_color"
fi
}
compctl -W ~/.pow -/ kapow

View file

@ -139,4 +139,4 @@ _arguments \
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "redis-cli subcommand" _1st_arguments _describe -t commands "redis-cli subcommand" _1st_arguments
return return
fi fi

View file

@ -1,4 +1,6 @@
# TODO: Make this compatible with rvm.
# Run sudo gem on the system ruby, not the active ruby.
alias sgem='sudo gem' alias sgem='sudo gem'
# Find ruby file # Find ruby file
alias rfind='find . -name *.rb | xargs grep -n' alias rfind='find . -name *.rb | xargs grep -n'

147
plugins/rvm/_rvm Normal file
View file

@ -0,0 +1,147 @@
#compdef rvm
local curcontext="$curcontext" state line cmds ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
'-e[Execute code from the command line]:code' \
'(-G)-G[root gem path to use]:path:_files' \
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
'(--head)--head[with update, updates rvm to git head version]' \
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
'(--force)--force[Force install, removes old install & source before install]' \
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
'(--docs)--docs[with install, attempt to generate ri after installation]' \
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
cmds)
cmds=(
"version:show the rvm version installed in rvm_path"
"use:setup current shell to use a specific ruby version"
"reload:reload rvm source itself (useful after changing rvm source)"
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
"update:upgrades rvm to the latest version."
"reset:remove current and stored default & system settings."
"info :show the *current* environment information for current ruby"
"current:print the *current* ruby version and the name of any gemset being used."
"debug:show info plus additional information for common issues"
"install:install one or many ruby versions"
"uninstall:uninstall one or many ruby versions, leaves their sources"
"remove:uninstall one or many ruby versions and remove their sources"
"migrate:Lets you migrate all gemsets from one ruby to another."
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
"disk-usage:Tells you how much disk space rvm install is using."
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
"docs:Tools to make installing ri and rdoc documentation easier."
"rvmrc:Tools related to managing rvmrc trust and loading."
"exec:runs an arbitrary command as a set operation."
"ruby:runs a named ruby file against specified and/or all rubies"
"gem:runs a gem command using selected ruby's 'gem'"
"rake:runs a rake task against specified and/or all rubies"
"tests:runs 'rake test' across selected ruby versions"
"specs:runs 'rake spec' across selected ruby versions"
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
"rubygems:Switches the installed version of rubygems for the current ruby."
"gemdir:display the path to the current gem directory (GEM_HOME)."
"srcdir:display the path to rvm source directory (may be yanked)"
"fetch:Performs an archive / src fetch only of the selected ruby."
"list:show currently installed rubies, interactive output."
"package:Install a dependency package {readline,iconv,zlib,openssl}"
"notes:Display notes, with operating system specifics."
"export:Temporarily set an environment variable in the current shell."
"unexport:Undo changes made to the environment by 'rvm export'."
)
_describe -t commands 'rvm command' cmds && ret=0
;;
args)
case $line[1] in
(use|uninstall|remove|list)
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
;;
(install|fetch)
_values -S , 'rubies' $(rvm list known_strings) && ret=0
;;
gemset)
if (( CURRENT == 3 )); then
_values 'gemset_commands' \
'import' \
'export' \
'create' \
'copy' \
'rename' \
'empty' \
'delete' \
'name' \
'dir' \
'list' \
'list_all' \
'gemdir' \
'install' \
'pristine' \
'clear' \
'use' \
'update' \
'unpack' \
'globalcache'
else
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
fi
ret=0
;;
package)
if (( CURRENT == 3 )); then
_values 'package_commands' \
'install' \
'uninstall'
else
_values 'packages' \
'readline' \
'iconv' \
'curl' \
'openssl' \
'zlib' \
'autoconf' \
'ncurses' \
'pkgconfig' \
'gettext' \
'glib' \
'mono' \
'llvm' \
'libxml2' \
'libxslt' \
'libyaml'
fi
ret=0
;;
*)
(( ret )) && _message 'no more arguments'
;;
esac
;;
esac
return ret

View file

@ -0,0 +1,57 @@
# Get the name of the current branch.
function rvm_prompt_info() {
local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null)
if [[ -n "$ruby_version" ]]; then
echo "($ruby_version)"
fi
}
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7-p334'
local ruby19='ruby-1.9.2-p180'
function rb18 {
if [ -z "$1" ]; then
rvm use "$ruby18"
else
rvm use "$ruby18@$1"
fi
}
_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`}
compdef _rb18 rb18
function rb19 {
if [ -z "$1" ]; then
rvm use "$ruby19"
else
rvm use "$ruby19@$1"
fi
}
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
compdef _rb19 rb19
function rvm-update {
rvm get head
rvm reload # TODO: Reload rvm completion?
}
function rvm-link-completion {
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official"
}
# TODO: Make this usable w/o rvm.
function gems {
local current_ruby=`rvm-prompt i v p`
local current_gemset=`rvm-prompt g`
gem list $@ | sed \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}

View file

@ -15,7 +15,7 @@ function in_svn() {
function svn_get_repo_name { function svn_get_repo_name {
if [ is_svn ]; then if [ is_svn ]; then
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
fi fi
} }
@ -29,9 +29,9 @@ function svn_get_rev_nr {
function svn_dirty_choose { function svn_dirty_choose {
if [ is_svn ]; then if [ is_svn ]; then
s=$(svn status 2>/dev/null) s=$(svn status 2>/dev/null)
if [ $s ]; then if [ $s ]; then
echo $1 echo $1
else else
echo $2 echo $2
fi fi
fi fi
@ -39,4 +39,4 @@ function svn_dirty_choose {
function svn_dirty { function svn_dirty {
svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
} }

View file

@ -1,11 +1,9 @@
alias et='mate .'
alias ett='mate app config lib db public spec test Rakefile Capfile Todo'
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo'
# TextMate # Edit Ruby app in TextMate
alias et='mate . &'
alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
# Editor Ruby file in TextMate
alias mr='mate CHANGELOG app config db lib public script spec test' alias mr='mate CHANGELOG app config db lib public script spec test'
function tm() { function tm() {

4
plugins/thor/_thor Normal file
View file

@ -0,0 +1,4 @@
#compdef thor
#autoload
compadd `thor list | grep thor | cut -d " " -f 2`

View file

@ -1,4 +1,4 @@
#compdef vagrant #compdef vagrant
#autoload #autoload
# vagrant zsh completion # vagrant zsh completion
@ -64,7 +64,7 @@ __vagrant-box ()
(options) (options)
case $line[1] in case $line[1] in
(repackage|remove) (repackage|remove)
_arguments ':feature:__box_list' _arguments ':feature:__box_list'
;; ;;
esac esac
;; ;;
@ -93,7 +93,7 @@ case $state in
(options) (options)
case $line[1] in case $line[1] in
(help) (help)
_arguments ':feature:__task_list' _arguments ':feature:__task_list'
;; ;;
(box) (box)

View file

@ -1,28 +1,24 @@
# Path to your oh-my-zsh configuration. # Path to oh-my-zsh.
export ZSH=$HOME/.oh-my-zsh export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. # Set the name of the theme to load (see $ZSH/themes/).
# Look in ~/.oh-my-zsh/themes/ # Setting it to 'random' loads a random theme.
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="robbyrussell" export ZSH_THEME="robbyrussell"
# Set to this to use case-sensitive completion # Set to 'true' to enable case-sensitivity.
# export CASE_SENSITIVE="true" export CASE_SENSITIVE='false'
# Comment this out to disable weekly auto-update checks # Set to 'true' to disable color (auto set on dumb terminals).
# export DISABLE_AUTO_UPDATE="true" export DISABLE_COLOR='false'
# Uncomment following line if you want to disable colors in ls # Set to 'true' to disable auto setting the tab and window titles.
# export DISABLE_COLOR="true" export DISABLE_AUTO_TITLE='false'
# Uncomment following line if you want to disable autosetting terminal title. # Set the plugins to load (see $ZSH/plugins/).
# export DISABLE_AUTO_TITLE="true" # Example: plugins=(rails git textmate ruby lighthouse)
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git) plugins=(git)
source $ZSH/oh-my-zsh.sh source "$ZSH/oh-my-zsh.sh"
# Customize to your needs... # Customize to your needs...

View file

@ -1,14 +1,30 @@
PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) local R="%{$terminfo[sgr0]%}"
PROMPT='%{$fg[blue]%}%n$R on %{$fg[red]%}%M$R in %{$fg[blue]%}%~%b$R$GIT_PROMPT_INFO
$ ' $ '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" git_prompt_info ()
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" {
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO="($(rvm_gemset)$R)"
return
fi
# Text to display if the branch is dirty local prompt=''
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
# Text to display if the branch is clean git_prompt__branch
ZSH_THEME_GIT_PROMPT_CLEAN="" prompt="%{$fg[white]%}$GIT_PROMPT_BRANCH"
git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO"
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%}*"
fi
GIT_PROMPT_INFO="($(rvm_gemset)$(git_time_since_commit)$prompt$R)"
}
# Colors vary depending on time lapsed. # Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
@ -17,25 +33,12 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
# Git sometimes goes into a detached head state. git_prompt_info doesn't
# return anything in this case. So wrap it in another function and check
# for an empty string.
function check_git_prompt_info() {
if git rev-parse --git-dir > /dev/null 2>&1; then
if [[ -z $(git_prompt_info) ]]; then
echo "%{$fg[magenta]%}detached-head%{$reset_color%})"
else
echo "$(git_prompt_info)"
fi
fi
}
# Determine if we are using a gemset. # Determine if we are using a gemset.
function rvm_gemset() { function rvm_gemset() {
GEMSET=`rvm gemset list | grep '=>' | cut -b4-` GEMSET=`rvm gemset list | grep '=>' | cut -b4-`
if [[ -n $GEMSET ]]; then if [[ -n $GEMSET ]]; then
echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" echo "%{$fg[yellow]%}${GEMSET}$R|"
fi fi
} }
@ -53,12 +56,12 @@ function git_time_since_commit() {
# Totals # Totals
MINUTES=$((seconds_since_last_commit / 60)) MINUTES=$((seconds_since_last_commit / 60))
HOURS=$((seconds_since_last_commit/3600)) HOURS=$((seconds_since_last_commit/3600))
# Sub-hours and sub-minutes # Sub-hours and sub-minutes
DAYS=$((seconds_since_last_commit / 86400)) DAYS=$((seconds_since_last_commit / 86400))
SUB_HOURS=$((HOURS % 24)) SUB_HOURS=$((HOURS % 24))
SUB_MINUTES=$((MINUTES % 60)) SUB_MINUTES=$((MINUTES % 60))
if [[ -n $(git status -s 2> /dev/null) ]]; then if [[ -n $(git status -s 2> /dev/null) ]]; then
if [ "$MINUTES" -gt 30 ]; then if [ "$MINUTES" -gt 30 ]; then
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
@ -72,15 +75,15 @@ function git_time_since_commit() {
fi fi
if [ "$HOURS" -gt 24 ]; then if [ "$HOURS" -gt 24 ]; then
echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" echo "$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m$R|"
elif [ "$MINUTES" -gt 60 ]; then elif [ "$MINUTES" -gt 60 ]; then
echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" echo "$COLOR${HOURS}h${SUB_MINUTES}m$R|"
else else
echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" echo "$COLOR${MINUTES}m$R|"
fi fi
else else
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
echo "($(rvm_gemset)$COLOR~|" echo "$COLOR~|"
fi fi
fi fi
} }

View file

@ -2,7 +2,7 @@ if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $GIT_PROMPT_INFO%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
RPS1="${return_code}" RPS1="${return_code}"

View file

@ -1,7 +1,7 @@
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' RPROMPT='%{$fg[$NCOLOR]%}%p $GIT_PROMPT_INFO%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:" ZSH_THEME_GIT_PROMPT_PREFIX="git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""

View file

@ -1,24 +1,34 @@
# ------------------------------------------------------------------------------
# FILE: ashleydev.theme.zsh
# DESCRIPTION: oh-my-zsh prompt theme, shows vi mode, last shell return code,
# and verbose git info.
# AUTHOR: Ashley Dev (the.ashley.dev+zsh-theme@gmail.com)
# VERSION: 3.0
# SCREENSHOT: http://i.imgur.com/Yw1KG.png
# http://i.imgur.com/wx6MU.png
# ------------------------------------------------------------------------------
# NOTE: make sure to add 'git' to your list of oh-my-zsh plugins (in your # NOTE: make sure to add 'git' to your list of oh-my-zsh plugins (in your
# ~/.zshrc), otherwise the git prompt info will not be shown. # ~/.zshrc), otherwise the git prompt info will not be shown.
#-------------------- Colors ---------------------- #-------------------- Colors ----------------------
# Colors ('_C' for color): # Colors ('_C' for color):
if [[ "$DISABLE_COLOR" != "true" ]]; then if [[ "$DISABLE_COLOR" != "true" ]]; then
# git prompt info colors:
local _Cerror_="%{$fg[yellow]%}" # bad (empty) .git/ directory
local _Cb_new_repo_="%{$fg_bold[default]%}" # branch color of new repo
local _Cb_clean_="%{$fg_no_bold[green]%}" # branch color when clean
local _Cb_dirty_="%{$fg_no_bold[red]%}" # branch color when dirty
local _Cr_="%{$bold_color$fg[yellow]%}" # rebase info
local _Ci_="%{$bold_color$fg[red]%}" # index info
local _Cu_clean_="" # untracked files state when clean
local _Cu_dirty_="%{$fg_bold[red]%}" # untracked files state when dirty
local _Cp_="%{${fg[cyan]}%}" # upstream info
local _Cs_="" # stash state
# Reset formating: # Reset formating:
local R="%{$terminfo[sgr0]%}" local R="%{$terminfo[sgr0]%}"
# git prompt info colors:
local _Cerror_="%{$fg[yellow]%}" # bad (empty) .git/ directory
local _Cbranch_new_repo_="%{$fg_bold[default]%}" # branch color of new repo
local _Cbranch_clean_="%{$fg_no_bold[green]%}" # branch color when clean
local _Cbranch_dirty_="%{$fg_no_bold[red]%}" # branch color when dirty
local _Crebase_="%{$bold_color$fg[yellow]%}" # rebase info
local _Cindex_="%{$bold_color$fg[red]%}" # index info
local _Cuntracked_clean_="" # untracked files state when clean
local _Cuntracked_dirty_="%{$fg_bold[red]%}" # untracked files state when dirty
local _Cupstream_="%{${fg[cyan]}%}" # upstream info
local _Cstash_="" # stash state
# PROMPT colors: # PROMPT colors:
local _Cuser_root_="%{$fg_bold[yellow]$bg[red]%}" local _Cuser_root_="%{$fg_bold[yellow]$bg[red]%}"
local _Chost_root_="%{$fg[red]%}" local _Chost_root_="%{$fg[red]%}"
@ -34,102 +44,15 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then
local _Cvi_mode_="%{$fg_bold[cyan]%}" local _Cvi_mode_="%{$fg_bold[cyan]%}"
fi fi
#-----------------------------------------------------
# git prompt info:
# The git prompt plugin will cause $GIT_PROMPT_INFO_FUNC to be called
# when $__GIT_PROMPT_INFO needs to be updated.
GIT_PROMPT_INFO_FUNC="update__GIT_PROMPT_INFO"
GIT_PROMPT_SHOWUPSTREAM="verbose"
GIT_PROMPT_SHORTCIRCUIT='on'
local __GIT_PROMPT_INFO=''
# will set __GIT_PROMPT_INFO
update__GIT_PROMPT_INFO ()
{
local g="$(_git_promt__git_dir)"
if [ -z "$g" ]; then
__GIT_PROMPT_INFO=''
return
fi
_git_prompt__stash
local s=$GIT_PROMPT_STASH_STATE_DIRTY
_git_prompt__upstream
local p=$GIT_PROMPT_UPSTREAM_STATE
_git_prompt__branch
local b=$GIT_PROMPT_BRANCH
_git_prompt__rebase_info
local r=$GIT_PROMPT_REBASE_INFO
_git_prompt__dirty_state
local w=$GIT_PROMPT_DIRTY_STATE_WORKTREE_DIRTY
local i=$GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY
local u=$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED
local f=$GIT_PROMPT_DIRTY_STATE_FRESH_REPO
if [ -z "$b$i$w$u" ]; then
if [ -n "$g" ]; then
__GIT_PROMPT_INFO="$R$_Cerror_(Error: bad ./$g dir)$R"
return
fi
fi
if [ "$s" = 'yes' ]; then
s="$_Cs_\$$R"
else
s=""
fi
if [ -n "$p" ]; then
p="$_Cp_$p$R"
fi
if [ "$i" = "yes" ]; then
i="$_Ci_+$R"
else
i=""
fi
if [ -n "$b" ]; then
if [ "$f" = "yes" ]; then
# this is a fresh repo, nothing here...
b="$_Cb_new_repo_$b$R"
elif [ "$w" = 'yes' ]; then
b="$_Cb_dirty_$b$R"
elif [ "$w" = 'no' ]; then
b="$_Cb_clean_$b$R"
fi
fi
if [ -n "$r" ]; then
r="$_Cr_$r$R"
fi
local _prompt="$b$r$i$s$p"
# add ( ) around _prompt:
if [ "$u" = "yes" ]; then
_prompt="$_Cu_dirty_($_prompt$_Cu_dirty_)"
elif [ "$u" = "no" ]; then
_prompt="$_Cu_clean_($_prompt$_Cu_clean_)"
else
fi
__GIT_PROMPT_INFO="$R$_prompt$R"
}
#-------------------- PROMPT definition: ---------------------- #-------------------- PROMPT definition: ----------------------
# #
local user_="%(!.$_Cuser_root_.$_Cuser_)%n$R" local user_="%(!.$_Cuser_root_.$_Cuser_)%n$R"
local host_="%(!.$_Chost_root_.$_Chost_)%m$R" local host_="%(!.$_Chost_root_.$_Chost_)%m$R"
local path_="%(!.$_Cpath_root_.$_Cpath_)%~$R" local path_="%(!.$_Cpath_root_.$_Cpath_)%~$R"
local jobs_="%(1j.$_Cjobs_%j$R.)" local jobs_="%(1j.$_Cjobs_%j$R.)"
PROMPT='$user_$host_$path_ $__GIT_PROMPT_INFO$jobs_# ' PROMPT='$user_$host_$path_ $GIT_PROMPT_INFO$jobs_# '
local date_format_='%D{%a %b %d}, %*' local date_format_='%D{%a %b %d}, %*'
local date_="${_Cdate_}[$date_format_]$R" local date_="${_Cdate_}[$date_format_]$R"
@ -140,3 +63,81 @@ RPROMPT='$return_code_$date_'
# use the vi-mode oh-my-zsh plugin to get this: # use the vi-mode oh-my-zsh plugin to get this:
MODE_INDICATOR="${_Cvi_mode_}-- CMD MODE -- $R" MODE_INDICATOR="${_Cvi_mode_}-- CMD MODE -- $R"
#-------------------- Git prompt info format: ----------------------
git_prompt_info ()
{
local dir_="$(git_prompt__git_dir)"
if [ -z "$dir_" ]; then
GIT_PROMPT_INFO=''
return
fi
git_prompt__stash
local stash_=$GIT_PROMPT_STASH_STATE_DIRTY
git_prompt__upstream
local upstream_=$GIT_PROMPT_UPSTREAM_STATE
git_prompt__branch
local branch_=$GIT_PROMPT_BRANCH
git_prompt__rebase_info
local rebase_=$GIT_PROMPT_REBASE_INFO
git_prompt__dirty_state
local work_=$GIT_PROMPT_DIRTY_STATE_WORKTREE_DIRTY
local index_=$GIT_PROMPT_DIRTY_STATE_INDEX_DIRTY
local untracked_=$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED
local freshy_=$GIT_PROMPT_DIRTY_STATE_FRESH_REPO
if [ -z "$branch_$index_$work_$untracked_" ]; then
if [ -n "$dir_" ]; then
GIT_PROMPT_INFO="$R$_Cerror_(Error: bad ./$dir_ dir)$R"
return
fi
fi
if [ "$stash_" = 'yes' ]; then
stash_="$_Cstash_\$$R"
else
stash_=""
fi
if [ -n "$upstream_" ]; then
upstream_="$_Cupstream_$upstream_$R"
fi
if [ "$index_" = "yes" ]; then
index_="$_Cindex_+$R"
else
index_=""
fi
if [ -n "$branch_" ]; then
if [ "$freshy_" = "yes" ]; then
# this is a fresh repo, nothing here...
branch_="$_Cbranch_new_repo_$branch_$R"
elif [ "$work_" = 'yes' ]; then
branch_="$_Cbranch_dirty_$branch_$R"
elif [ "$work_" = 'no' ]; then
branch_="$_Cbranch_clean_$branch_$R"
fi
fi
if [ -n "$rebase_" ]; then
rebase_="$_Crebase_$rebase_$R"
fi
local _prompt="$branch_$rebase_$index_$stash_$upstream_"
# add ( ) around _prompt:
if [ "$untracked_" = "yes" ]; then
_prompt="$_Cuntracked_dirty_($_prompt$_Cuntracked_dirty_)"
elif [ "$untracked_" = "no" ]; then
_prompt="$_Cuntracked_clean_($_prompt$_Cuntracked_clean_)"
else
_prompt="($_prompt)"
fi
GIT_PROMPT_INFO="$R$_prompt$R"
}

View file

@ -1,5 +1,5 @@
PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$GIT_PROMPT_INFO$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color
$ ' $ '
# git theming # git theming
ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green]("

View file

@ -1,6 +1,6 @@
# the svn plugin has to be activated for this to work. # the svn plugin has to be activated for this to work.
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
@ -15,4 +15,4 @@ ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}"
ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" ZSH_THEME_SVN_PROMPT_PREFIX="svn:("
ZSH_THEME_SVN_PROMPT_SUFFIX=")" ZSH_THEME_SVN_PROMPT_SUFFIX=")"
ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}"
ZSH_THEME_SVN_PROMPT_CLEAN=" " ZSH_THEME_SVN_PROMPT_CLEAN=" "

View file

@ -4,7 +4,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
local rvm_ruby='%{$fg[red]%}$(rvm-prompt i v g)%{$reset_color%}' local rvm_ruby='%{$fg[red]%}$(rvm-prompt i v g)%{$reset_color%}'
local git_branch='$(git_prompt_info)%{$reset_color%}' local git_branch='$GIT_PROMPT_INFO%{$reset_color%}'
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─%B$%b " ╰─%B$%b "

View file

@ -1,4 +1,4 @@
PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $GIT_PROMPT_INFO\
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["

View file

@ -1,6 +1,6 @@
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $GIT_PROMPT_INFO%(!.#.$) '
RPROMPT='[%*]' RPROMPT='[%*]'
# git theming # git theming

View file

@ -1,6 +1,6 @@
PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"

View file

@ -8,7 +8,7 @@ DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
# Grab the current filepath, use shortcuts: ~/Desktop # Grab the current filepath, use shortcuts: ~/Desktop
# Append the current git branch, if in a git repository: ~aw@master # Append the current git branch, if in a git repository: ~aw@master
DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$GIT_PROMPT_INFO%{$reset_color%}"
# Grab the current username: dallas # Grab the current username: dallas
DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}"
# Use a % for normal users and a # for privelaged (root) users. # Use a % for normal users and a # for privelaged (root) users.

View file

@ -1,6 +1,6 @@
# meh. Dark Blood Rewind, a new beginning. # meh. Dark Blood Rewind, a new beginning.
PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$GIT_PROMPT_INFO%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}])
%{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} ' %{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} '
PS2=$' %{$fg[red]%}|>%{$reset_color%} ' PS2=$' %{$fg[red]%}|>%{$reset_color%} '

View file

@ -1,7 +1,7 @@
# Copied and modified from the oh-my-zsh theme from geoffgarside # Copied and modified from the oh-my-zsh theme from geoffgarside
# Red server name, green cwd, blue git status # Red server name, green cwd, blue git status
PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$GIT_PROMPT_INFO %(!.#.$) '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"

View file

@ -26,7 +26,7 @@ local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
# Compacted $PWD # Compacted $PWD
local pwd="%{$fg[blue]%}%c%{$reset_color%}" local pwd="%{$fg[blue]%}%c%{$reset_color%}"
PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' PROMPT='${time} ${user}${host} ${pwd} $GIT_PROMPT_INFO'
# i would prefer 1 icon that shows the "most drastic" deviation from HEAD, # i would prefer 1 icon that shows the "most drastic" deviation from HEAD,
# but lets see how this works out # but lets see how this works out

View file

@ -6,30 +6,70 @@
# SCREENSHOT: coming soon # SCREENSHOT: coming soon
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
MODE_INDICATOR="%{$fg_bold[red]%}%{$reset_color%}%{$fg[red]%}%{$reset_color%}" local R="%{$terminfo[sgr0]%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) MODE_INDICATOR="%{$fg_bold[red]%}$R%{$fg[red]%}$R"
%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' local return_status="%{$fg[red]%}%(?..⏎)$R"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" PROMPT='%{$fg[blue]%}%m$R%{$fg_bold[white]%} ओम् $R%{$fg[cyan]%}%~:$R$GIT_PROMPT_INFO
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" %{$fg[red]%}%!$R $(prompt_char) '
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
GIT_RPROMPT_INFO=''
return
fi
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" local prompt=''
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" git_prompt__branch
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" prompt="%{$fg_bold[green]%}git$R@%{$bg[white]%}%{$fg[black]%}$GIT_PROMPT_BRANCH"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO"
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%}!"
fi
GIT_PROMPT_INFO="($(git_time_since_commit)$prompt$R)"
local rprompt=''
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
rprompt="%{$fg[green]%} ✚"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[blue]%} ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[blue]%} ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[red]%} ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[red]%} ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[magenta]%} ➜"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[yellow]%} ═"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[cyan]%} ✭"
fi
GIT_RPROMPT_INFO=$rprompt
}
RPROMPT='${return_status}$GIT_RPROMPT_INFO$R'
function prompt_char() { function prompt_char() {
git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±$R" && return
hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿$R" && return
echo "%{$fg[cyan]%}◯ %{$reset_color%}" echo "%{$fg[cyan]%}◯ $R"
} }
# Colors vary depending on time lapsed. # Colors vary depending on time lapsed.
@ -40,7 +80,8 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
# Determine the time since last commit. If branch is clean, # Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time. # use a neutral color, otherwise colors will vary according to time.
function git_time_since_commit() { git_time_since_commit ()
{
if git rev-parse --git-dir > /dev/null 2>&1; then if git rev-parse --git-dir > /dev/null 2>&1; then
# Only proceed if there is actually a commit. # Only proceed if there is actually a commit.
if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
@ -71,15 +112,15 @@ function git_time_since_commit() {
fi fi
if [ "$HOURS" -gt 24 ]; then if [ "$HOURS" -gt 24 ]; then
echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" echo "$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m$R|"
elif [ "$MINUTES" -gt 60 ]; then elif [ "$MINUTES" -gt 60 ]; then
echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" echo "$COLOR${HOURS}h${SUB_MINUTES}m$R|"
else else
echo "($COLOR${MINUTES}m%{$reset_color%}|" echo "$COLOR${MINUTES}m$R|"
fi fi
else else
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
echo "($COLOR~|" echo "$COLOR~|"
fi fi
fi fi
} }

View file

@ -10,7 +10,7 @@ function prompt_char {
PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
) )
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$GIT_PROMPT_INFO
%_ $(prompt_char) ' %_ $(prompt_char) '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'

View file

@ -9,11 +9,32 @@ function virtualenv_info {
} }
PROMPT=' PROMPT='
%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) %{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$GIT_PROMPT_INFO
$(virtualenv_info)$(prompt_char) ' $(virtualenv_info)$(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" git_prompt_info ()
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" {
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" if [ -z "$(git_prompt__git_dir)" ]; then
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" GIT_PROMPT_INFO=''
ZSH_THEME_GIT_PROMPT_CLEAN="" return
fi
local prompt=""
git_prompt__branch
prompt=$GIT_PROMPT_BRANCH
git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO"
if [[ -n "$prompt" ]]; then
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
prompt="$prompt%{$fg[green]%}!"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
prompt="$prompt%{$fg[green]%}?"
fi
GIT_PROMPT_INFO=" on %{$fg[magenta]%}$prompt%{$reset_color%}"
fi
}

View file

@ -1,19 +1,30 @@
#RVM settings #RVM settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
fi fi
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" local R="%{$terminfo[sgr0]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch git_prompt_info ()
git_custom_status() { {
local cb=$(current_branch) if [ -z "$(git_prompt__git_dir)" ]; then
if [ -n "$cb" ]; then GIT_PROMPT_INFO=''
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" return
fi fi
git_prompt__branch
local cb=$GIT_PROMPT_BRANCH
git_prompt__rebase_info
cb="${cb}$GIT_PROMPT_REBASE_INFO"
local dirty
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
dirty="%{$fg[red]%}*%{$reset_color%}"
fi
GIT_PROMPT_INFO="$dirty$R%{$fg[green]%}[$cb]$R"
} }
PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' PROMPT='$GIT_PROMPT_INFO%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b '

View file

@ -1,4 +1,4 @@
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"

View file

@ -1,2 +1,2 @@
# Evan describes this sexy prompt as: "a skinny, topless prompt" # Evan describes this sexy prompt as: "a skinny, topless prompt"
PROMPT='%m :: %2~ %B»%b ' PROMPT='%m :: %2~ %B»%b '

View file

@ -2,4 +2,4 @@
# http://zshwiki.org/home/config/prompt # http://zshwiki.org/home/config/prompt
# #
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "

View file

@ -3,7 +3,49 @@
local user_color='green'; [ $UID -eq 0 ] && user_color='red' local user_color='green'; [ $UID -eq 0 ] && user_color='red'
PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}' PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}" local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" RPROMPT='${return_status}$GIT_PROMPT_INFO%{$reset_color%}'
git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
return
fi
local prompt=''
git_prompt__branch
prompt=" $GIT_PROMPT_BRANCH"
git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO"
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
prompt="${prompt}%{$fg[green]%} +"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
prompt="${prompt}%{$fg[blue]%} !"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
prompt="${prompt}%{$fg[blue]%} !"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%} -"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%} -"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
prompt="${prompt}%{$fg[magenta]%} >"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
prompt="${prompt}%{$fg[yellow]%} #"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
prompt="${prompt}%{$fg[cyan]%} ?"
fi
GIT_PROMPT_INFO=$prompt
}

View file

@ -5,7 +5,7 @@ fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $GIT_PROMPT_INFO%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} '
RPS1='$(vi_mode_prompt_info) ${return_code}' RPS1='$(vi_mode_prompt_info) ${return_code}'

View file

@ -1,5 +1,5 @@
# Copied from old version of tonotdo's theme. LSCOLORS modified. # Copied from old version of tonotdo's theme. LSCOLORS modified.
PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$GIT_PROMPT_INFO%{$reset_color%}» '
RPROMPT='[%*]' RPROMPT='[%*]'
# git theming # git theming

View file

@ -1,5 +1,5 @@
PROMPT=$' PROMPT=$'
%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} %{$fg[blue]%}%/%{$reset_color%} $GIT_PROMPT_INFO%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%}
%{$fg_bold[black]%}>%{$reset_color%} ' %{$fg_bold[black]%}>%{$reset_color%} '
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"

View file

@ -11,4 +11,4 @@ local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color
PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no}
╰─${blue_op}${smiley}${blue_cp} %# " ╰─${blue_op}${smiley}${blue_cp} %# "
local cur_cmd="${blue_op}%_${blue_cp}" local cur_cmd="${blue_op}%_${blue_cp}"
PROMPT2="${cur_cmd}> " PROMPT2="${cur_cmd}> "

6
themes/fwalch.zsh-theme Normal file
View file

@ -0,0 +1,6 @@
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"

View file

@ -1,7 +1,7 @@
# ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg # ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $GIT_PROMPT_INFO%{$reset_color%}%B»%b '
RPS1="${return_code}" RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"

View file

@ -1,19 +1,30 @@
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" git_prompt_info ()
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" {
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" if [ -z "$(git_prompt__git_dir)" ]; then
ZSH_THEME_GIT_PROMPT_CLEAN="" GIT_PROMPT_INFO=''
return
fi
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch git_prompt__branch
git_custom_status() { local cb=$GIT_PROMPT_BRANCH
local cb=$(current_branch)
if [ -n "$cb" ]; then git_prompt__rebase_info
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" cb="${cb}$GIT_PROMPT_REBASE_INFO"
fi
local dirty
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
dirty="%{$fg[red]%}*%{$reset_color%}"
fi
local R="%{$terminfo[sgr0]%}"
GIT_PROMPT_INFO="$dirty$R%{$fg[green]%}[$cb]$R"
} }
#RVM and git settings #RVM and git settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' RPS1='$GIT_PROMPT_INFO%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
fi fi
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '

View file

@ -1,4 +1,4 @@
PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%}% %{$reset_color%}: '
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"

View file

@ -1,4 +1,4 @@
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} ' PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $GIT_PROMPT_INFO%#%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") " ZSH_THEME_GIT_PROMPT_SUFFIX=") "

View file

@ -1,5 +1,5 @@
# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " # PROMPT="[%*] %n:%c $GIT_PROMPT_INFO%(!.#.$) "
PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$GIT_PROMPT_INFO %(!.#.$) '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"

View file

@ -1,15 +1,51 @@
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' local R="%{$terminfo[sgr0]%}"
ZSH_THEME_GIT_PROMPT_PREFIX="(" PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO % $R'
ZSH_THEME_GIT_PROMPT_SUFFIX=")" RPROMPT='$GIT_RPROMPT_INFO$R'
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
RPROMPT='$(git_prompt_status)%{$reset_color%}' git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
GIT_RPROMPT_INFO=''
return
fi
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" local prompt=''
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" git_prompt__branch
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" prompt="$GIT_PROMPT_BRANCH"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO"
GIT_PROMPT_INFO="($prompt)"
local rprompt=''
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
rprompt="%{$fg[cyan]%} ✈"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[yellow]%} ✭"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[yellow]%} ✭"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[red]%} ✗"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[red]%} ✗"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[blue]%} ➦"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[magenta]%} ✂"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
rprompt="${rprompt}%{$fg[grey]%} ✱"
fi
GIT_RPROMPT_INFO=$rprompt
}

View file

@ -2,4 +2,4 @@
# http://zshwiki.org/home/config/prompt # http://zshwiki.org/home/config/prompt
# #
PROMPT="%{$fg[red]%}%%%{$reset_color%} " PROMPT="%{$fg[red]%}%%%{$reset_color%} "

View file

@ -1,4 +1,4 @@
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}' PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$GIT_PROMPT_INFO%{$fg_bold[white]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"

View file

@ -5,15 +5,15 @@ function precmd {
### ###
# Truncate the path if it's too long. # Truncate the path if it's too long.
PR_FILLBAR="" PR_FILLBAR=""
PR_PWDLEN="" PR_PWDLEN=""
local promptsize=${#${(%):---(%n@%m:%l)---()--}} local promptsize=${#${(%):---(%n@%m:%l)---()--}}
local rubyprompt=`rvm_prompt_info` local rubyprompt=`rvm_prompt_info`
local rubypromptsize=${#${rubyprompt}} local rubypromptsize=${#${rubyprompt}}
local pwdsize=${#${(%):-%~}} local pwdsize=${#${(%):-%~}}
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
((PR_PWDLEN=$TERMWIDTH - $promptsize)) ((PR_PWDLEN=$TERMWIDTH - $promptsize))
else else
@ -32,7 +32,51 @@ preexec () {
} }
setprompt () { git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
return
fi
local prompt=''
git_prompt__branch
prompt=" on %{$fg[green]%}$GIT_PROMPT_BRANCH"
git_prompt__rebase_info
prompt="${prompt}$GIT_PROMPT_REBASE_INFO%{$terminfo[sgr0]%}"
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
prompt="${prompt}%{$fg[green]%} ✚"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
prompt="${prompt}%{$fg[blue]%} ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
prompt="${prompt}%{$fg[blue]%} ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%} ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
prompt="${prompt}%{$fg[red]%} ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
prompt="${prompt}%{$fg[magenta]%} ➜"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
prompt="${prompt}%{$fg[yellow]%} ═"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
prompt="${prompt}%{$fg[cyan]%} ✭"
fi
GIT_PROMPT_INFO=$prompt
}
setprompt ()
{
### ###
# Need this so the prompt will work. # Need this so the prompt will work.
@ -53,23 +97,9 @@ setprompt () {
done done
PR_NO_COLOUR="%{$terminfo[sgr0]%}" PR_NO_COLOUR="%{$terminfo[sgr0]%}"
###
# Modify Git prompt
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
### ###
# See if we can use extended characters to look nicer. # See if we can use extended characters to look nicer.
typeset -A altchar typeset -A altchar
set -A altchar ${(s..)terminfo[acsc]} set -A altchar ${(s..)terminfo[acsc]}
PR_SET_CHARSET="%{$terminfo[enacs]%}" PR_SET_CHARSET="%{$terminfo[enacs]%}"
@ -81,10 +111,10 @@ setprompt () {
PR_LRCORNER=${altchar[j]:--} PR_LRCORNER=${altchar[j]:--}
PR_URCORNER=${altchar[k]:--} PR_URCORNER=${altchar[k]:--}
### ###
# Decide if we need to set titlebar text. # Decide if we need to set titlebar text.
case $TERM in case $TERM in
xterm*) xterm*)
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
@ -96,8 +126,8 @@ setprompt () {
PR_TITLEBAR='' PR_TITLEBAR=''
;; ;;
esac esac
### ###
# Decide whether to set a screen title # Decide whether to set a screen title
if [[ "$TERM" == "screen" ]]; then if [[ "$TERM" == "screen" ]]; then
@ -105,8 +135,8 @@ setprompt () {
else else
PR_STITLE='' PR_STITLE=''
fi fi
### ###
# Finally, the prompt. # Finally, the prompt.
@ -119,7 +149,7 @@ $PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ $PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
$PR_YELLOW%D{%H:%M:%S}\ $PR_YELLOW%D{%H:%M:%S}\
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ $PR_LIGHT_BLUE%{$reset_color%}$GIT_PROMPT_INFO$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\
$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ $PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
>$PR_NO_COLOUR ' >$PR_NO_COLOUR '

View file

@ -15,7 +15,7 @@ function josh_prompt {
branch_size=${#branch} branch_size=${#branch}
ruby_size=${#ruby_version} ruby_size=${#ruby_version}
user_machine_size=${#${(%):-%n@%m-}} user_machine_size=${#${(%):-%n@%m-}}
if [[ ${#branch} -eq 0 ]] if [[ ${#branch} -eq 0 ]]
then (( ruby_size = ruby_size + 1 )) then (( ruby_size = ruby_size + 1 ))
else else
@ -24,15 +24,15 @@ function josh_prompt {
(( branch_size = branch_size + 2 )) (( branch_size = branch_size + 2 ))
fi fi
fi fi
(( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
while [ ${#prompt} -lt $spare_width ]; do while [ ${#prompt} -lt $spare_width ]; do
prompt=" $prompt" prompt=" $prompt"
done done
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $GIT_PROMPT_INFO"
echo $prompt echo $prompt
} }

View file

@ -4,7 +4,7 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
$(git_prompt_info)\ $GIT_PROMPT_INFO\
%{$fg[red]%}%(!.#.»)%{$reset_color%} ' %{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}' PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}' RPS1='${return_code}'

View file

@ -1,4 +1,4 @@
#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' #PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$GIT_PROMPT_INFO%{$fg_bold[blue]%} % %{$reset_color%}'
PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d
%{$fg_bold[yellow]%}%% %{$reset_color%}" %{$fg_bold[yellow]%}%% %{$reset_color%}"

View file

@ -1,6 +1,5 @@
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# Juan G. Hurtado oh-my-zsh theme # Juan G. Hurtado oh-my-zsh theme
# (Needs Git plugin for current_branch method)
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# Color shortcuts # Color shortcuts
@ -16,31 +15,68 @@ WHITE_BOLD=$fg_bold[white]
BLUE_BOLD=$fg_bold[blue] BLUE_BOLD=$fg_bold[blue]
RESET_COLOR=$reset_color RESET_COLOR=$reset_color
# Format for git_prompt_info()
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
# Format for parse_git_dirty()
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# Format for git_prompt_status()
ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged"
ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted"
ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed"
ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified"
ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added"
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked"
# Format for git_prompt_ahead()
ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)"
# Format for git_prompt_long_sha() and git_prompt_short_sha()
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
# Prompt format # Prompt format
PROMPT=' PROMPT='
%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} %{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$GIT_PROMPT_INFO%{$RESET_COLOR%}
%{$BLUE%}>%{$RESET_COLOR%} ' %{$BLUE%}>%{$RESET_COLOR%} '
RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' RPROMPT='%{$GREEN_BOLD%}$GIT_RPROMPT_INFO%{$RESET_COLOR%}'
git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
GIT_RPROMPT_INFO=''
return
fi
local dirty=''
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_ANY_DIRTY" = 'yes' ]]; then
dirty=" %{$RED%}(*)"
fi
git_prompt__upstream
if [[ "$GIT_PROMPT_UPSTREAM_STATE" != "=" ]]; then
local upstream=" %{$RED%}($GIT_PROMPT_UPSTREAM_STATE)"
fi
GIT_PROMPT_INFO="$dirty$upstream"
git_prompt__branch
local current_branch="$GIT_PROMPT_BRANCH"
git_prompt__rebase_info
current_branch="${current_branch}$GIT_PROMPT_REBASE_INFO"
local sha=$(git rev-parse --short HEAD 2> /dev/null)
if [[ -n "$sha" ]]; then
sha=" %{$WHITE%}[%{$YELLOW%}$sha%{$WHITE%}]"
fi
local git_status=''
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
git_status="%{$GREEN%} added"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
git_status="${git_status}%{$YELLOW%} modified"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
git_status="${git_status}%{$YELLOW%} modified"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
git_status="${git_status}%{$RED%} deleted"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
git_status="${git_status}%{$RED%} deleted"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
git_status="${git_status}%{$YELLOW%} renamed"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
git_status="${git_status}%{$RED%} unmerged"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
git_status="${git_status}%{$WHITE%} untracked"
fi
GIT_RPROMPT_INFO="$current_branch$sha$git_status"
}

View file

@ -5,8 +5,8 @@ function get_host {
} }
PROMPT='> ' PROMPT='> '
RPROMPT='%~$(git_prompt_info)$(get_host)' RPROMPT='%~$GIT_PROMPT_INFO$(get_host)'
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")" ZSH_THEME_GIT_PROMPT_SUFFIX=")"

View file

@ -1,7 +1,7 @@
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[green]%}%c \ PROMPT='%{$fg[green]%}%c \
$(git_prompt_info)\ $GIT_PROMPT_INFO\
%{$fg[red]%}%(!.#.»)%{$reset_color%} ' %{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}' PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} '

View file

@ -6,45 +6,66 @@
# SCREENSHOT: # SCREENSHOT:
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_COLORS" != "true" ]]; then
if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then local R="%{$terminfo[sgr0]%}"
PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] local MAGENTA="%{$fg[magenta]%}"
%# ' local YELLOW="%{$fg[yellow]%}"
local GREEN="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" local BLUE="%{$fg[blue]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" local CYAN="%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_DIRTY="" local RED="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# display exitcode on the right when >0
return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
else
PROMPT='[%n@%m:%~$(git_prompt_info)]
%# '
ZSH_THEME_GIT_PROMPT_PREFIX=" on"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
# display exitcode on the right when >0
return_code="%(?..%? ↵)"
RPROMPT='${return_code}$(git_prompt_status)'
ZSH_THEME_GIT_PROMPT_ADDED=" ✚"
ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹"
ZSH_THEME_GIT_PROMPT_DELETED=" ✖"
ZSH_THEME_GIT_PROMPT_RENAMED=" ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED=" ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭"
fi fi
PROMPT='[$RED%n$R@$MAGENTA%m$R:$BLUE%~$R$GIT_PROMPT_INFO]
%# '
# display exitcode on the right when >0
return_code="%(?..$RED%? ↵$R)"
RPROMPT='${return_code}$GIT_RPROMPT_INFO$R'
git_prompt_info ()
{
if [ -z "$(git_prompt__git_dir)" ]; then
GIT_PROMPT_INFO=''
GIT_RPROMPT_INFO=''
return
fi
local branch=''
git_prompt__branch
branch="$GIT_PROMPT_BRANCH"
git_prompt__rebase_info
branch="${branch}$GIT_PROMPT_REBASE_INFO"
GIT_PROMPT_INFO=" on $GREEN${branch}$R"
local rprompt=''
git_prompt__dirty_state
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_ADDED" = 'yes' ]]; then
rprompt="$GREEN ✚"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}$BLUE ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_MODIFIED" = 'yes' ]]; then
rprompt="${rprompt}$BLUE ✹"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_DELETED" = 'yes' ]]; then
rprompt="${rprompt}$RED ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_DELETED" = 'yes' ]]; then
rprompt="${rprompt}$RED ✖"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_RENAMED" = 'yes' ]]; then
rprompt="${rprompt}$MAGENTA ➜"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_INDEX_UNMERGED" = 'yes' ]]; then
rprompt="${rprompt}$YELLOW ═"
fi
if [[ "$GIT_PROMPT_DIRTY_STATE_WORKTREE_UNTRACKED" = 'yes' ]]; then
rprompt="${rprompt}$CYAN ✭"
fi
GIT_RPROMPT_INFO=$rprompt
}

View file

@ -1,6 +1,6 @@
# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S # ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S
PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' PROMPT='λ %~/ $GIT_PROMPT_INFO%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "

View file

@ -47,7 +47,7 @@ prompt_jnrowe_precmd () {
#dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/"
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
#dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
> ' > '
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
@ -55,7 +55,7 @@ prompt_jnrowe_precmd () {
PROMPT='${vcs_info_msg_0_} PROMPT='${vcs_info_msg_0_}
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> ' > '
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
@ -67,7 +67,7 @@ prompt_jnrowe_precmd () {
PROMPT='${vcs_info_msg_0_} PROMPT='${vcs_info_msg_0_}
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> ' > '
fi fi
} }

View file

@ -3,7 +3,7 @@
local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $GIT_PROMPT_INFO%{$reset_color%}%B»%b '
RPS1="${return_code}" RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("

View file

@ -1,7 +1,7 @@
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v) %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v) %{$reset_color%} $GIT_PROMPT_INFO%{$reset_color%}%B$%b '
RPS1="${return_code}" RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"

Some files were not shown because too many files have changed in this diff Show more