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

@ -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 po='popd'
# Basic directory operations
alias ...='cd ../..'
alias -- -='cd -'
# Super user
alias _='sudo'
#alias g='grep -in'
# Show history
alias e="$EDITOR"
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 lsa='ls -lah'
alias l='ls -la'
alias ll='ls -l'
alias sl=ls # often screw this up
alias z='vim -o ~/.zshenv ~/.oh-my-zsh/lib/aliases.zsh ~/.zshrc'
alias zs='source ~/.zshrc'
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
[[ "$TERM" == "dumb" ]] && return
# Dumb terminals lack support.
if [[ "$TERM" == 'dumb' ]]; then
return
fi
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end
unsetopt menu_complete # Do not autoselect the first completion entry.
unsetopt flow_control # Disable start/stop characters in shell editor.
setopt auto_menu # Show completion menu on a succesive tab press.
setopt complete_in_word # Complete from both ends of a word.
setopt always_to_end # Move cursor to the end of a completed word.
WORDCHARS=''
# fixme - complist is crashing ZSH on menu completion
# FIXME: complist is crashing ZSH on menu completion.
# zmodload -i zsh/complist
## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
## Case-insensitive (all), partial-word, and then substring completion.
if [[ "$CASE_SENSITIVE" == "true" ]]; then
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE
else
@ -22,18 +24,19 @@ fi
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
zstyle ':completion:*:*:*:*:*' menu select
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"
# disable named-directories autocompletion
# Disable named-directories autocompletion.
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
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 /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
hosts=(
@ -44,11 +47,11 @@ 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:*' cache-path ~/.oh-my-zsh/cache/
# Don't complete uninteresting users
# Don't complete uninteresting users...
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \

View file

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

View file

@ -1,7 +1,9 @@
# Changing/making/removing directory
setopt auto_name_dirs
setopt auto_pushd
setopt pushd_ignore_dups
setopt auto_cd # Auto cd to a directory without typing cd.
setopt auto_pushd # Push the old directory onto the stack on cd.
setopt pushd_ignore_dups # Don't store duplicates in the stack.
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..='cd ..'
@ -9,6 +11,7 @@ alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias cd/='cd /'
alias -- -='cd -'
alias 1='cd -'
alias 2='cd +2'
@ -34,11 +37,3 @@ cd () {
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
}
function uninstall_oh_my_zsh() {
/bin/sh $ZSH/tools/uninstall.sh
function mkdcd() {
mkdir -p "$1"
cd "$1"
}
function upgrade_oh_my_zsh() {
/bin/sh $ZSH/tools/upgrade.sh
function cdll() {
if [[ -n "$1" ]]; then
builtin cd "$1"
ls -lFhA
else
ls -lFhA
fi
}
function take() {
mkdir -p $1
cd $1
function pushdll() {
if [[ -n "$1" ]]; then
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
[[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto'
[[ -z "$GREP_COLOR" ]] && export GREP_COLOR='1;32'
if [[ "$DISABLE_COLOR" != 'true' ]]; then
if [[ -z "$GREP_OPTIONS" ]]; then
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

View file

@ -1,13 +1,14 @@
## Command history configuration
HISTFILE=$HOME/.zsh_history
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000
SAVEHIST=10000
setopt HIST_VERIFY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_SPACE
setopt HIST_IGNORE_DUPS
setopt SHARE_HISTORY
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt INC_APPEND_HISTORY
setopt hist_verify
setopt hist_expire_dups_first
setopt hist_ignore_space
setopt hist_ignore_dups
setopt share_history
setopt append_history
setopt extended_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 '\ew' kill-region
@ -8,7 +8,7 @@ bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-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 '^[[B' down-line-or-search
@ -16,18 +16,22 @@ bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line
bindkey "^[[F" 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
# 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;5~" 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 '^[[B' down-line-or-search
@ -40,6 +44,6 @@ bindkey "\e[3~" delete-char
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
## FIXME: A weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#

View file

@ -1,13 +1,17 @@
## smart urls
# Smart URLs
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
## file rename magick
bindkey "^[m" copy-prev-shell-word
## jobs
# Jobs
setopt long_list_jobs
## pager
[[ -z "$PAGER" ]] && export PAGER=less
[[ -z "$LC_CTYPE" ]] && export LC_CTYPE=en_US.UTF-8
# Pager
if [[ -z "$PAGER" ]]; then
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.
# A script to make using 256 colors in ZSH less painful in your PROMPT.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
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
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
#Fully support screen, iterm, and probably most modern xterm and rxvt
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
# Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals.
# Partially supports Mac OS X Terminal since it can't set window and tab separately.
# Usage: title "tab title" "window title"
function title {
[ "$DISABLE_AUTO_TITLE" != "true" ] || return
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
if [[ "$DISABLE_AUTO_TITLE" != 'true' ]]; then
if [[ "$TERM" == screen* ]]; then
# Set GNU Screen's hardstatus (usually truncated at 20 characters).
print -Pn "\ek$1:q\e\\"
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]]; then
# 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
}
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: %~"
#Appears when you have the prompt
# Set the tab and window titles before the prompt is displayed.
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 {
emulate -L zsh
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%<<"
}

View file

@ -1,35 +1,23 @@
# ls colors
autoload colors; colors;
[[ -z "$LSCOLORS" ]] && export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Load and run colors.
autoload -U colors
colors -i
# Enable ls colors
if [ "$DISABLE_COLOR" != "true" ]
then
# 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 "
# Set the GNU Screen window number.
if [[ -n "$WINDOW" ]]; then
SCREEN_NO="%B$WINDOW%b "
else
SCREEN_NO=""
SCREEN_NO=""
fi
# Apply theming defaults
# Set the default prompt theme.
PS1="%n@%m:%~%# "
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
# Set the default Git prompt theme.
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name.
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name.
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to display if the branch is dirty.
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