1
0
Fork 0

Cleaned up lib/ and removed trailing white space everywhere.

Conflicts:

	oh-my-zsh.sh
pull/3/head
Sorin Ionescu 14 years ago
parent fa0112b98e
commit 494ad7dcd9

@ -1,32 +1,35 @@
# The 'ls' family # The 'ls' family
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[[ "$DISABLE_COLOR" != 'true' ]] && { if [[ "$DISABLE_COLOR" != 'true' ]]; then
[[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' if (( ${+commands[dircolors]} )); then
} dircolors="${commands[dircolors]}"
fi
[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) if (( ${+commands[gdircolors]} )); then
[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 dircolors="${commands[gdircolors]}"
[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" fi
if [[ -x "$dircolors" ]] && [[ -e "$HOME/.dir_colors" ]]; then
# add colors for filetype recognition eval $("$dircolors" "$HOME/.dir_colors")
[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' alias ls='ls -hF --group-directories-first --color=auto'
[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' else
export CLICOLOR=1
export LSCOLORS="exfxcxdxbxegedabagacad"
alias ls='ls -G -F'
fi
fi
alias ll='ls -lh' # show human readable alias ll='ls -lh' # Show human readable.
alias la='ls -lhA' # show hidden files alias la='ls -lhA' # Show hidden files.
alias lx='ls -lhXB' # sort by extension alias lx='ls -lhXB' # Sort by extension.
alias lk='ls -lhSr' # sort by size, biggest last alias lk='ls -lhSr' # Sort by size, biggest last.
alias lc='ls -lhtcr' # sort by and show change time, most recent 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 lu='ls -lhtur' # Sort by and show access time, most recent last.
alias lt='ls -lhtr' # sort by date, most recent last alias lt='ls -lhtr' # Sort by date, most recent last.
alias lm='ls -lha | more' # pipe through 'more' alias lm='ls -lha | more' # Pipe through 'more'.
alias lr='ls -lhR' # recursive ls alias lr='ls -lhR' # Recursive ls.
alias sl='ls' # often screw this up alias sl='ls' # I often screw this up.
# General # General
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
alias ...='cd ../..'
alias -- -='cd -'
alias rm='nocorrect rm -i' alias rm='nocorrect rm -i'
alias cp='nocorrect cp -i' alias cp='nocorrect cp -i'
alias mv='nocorrect mv -i' alias mv='nocorrect mv -i'
@ -38,20 +41,13 @@ alias pu='pushd'
alias po='popd' alias po='popd'
alias _='sudo' alias _='sudo'
alias e="$EDITOR" alias e="$EDITOR"
alias q='exit'
alias history='fc -l 1' alias history='fc -l 1'
alias h='history'
alias j='jobs -l'
alias f='fg'
alias gr='grep -r'
alias get='curl -C - -O' alias get='curl -C - -O'
alias afind='ack-grep -il' alias afind='ack -il'
alias type='type -a' alias type='type -a'
alias ssh='ssh -X' alias ssh='ssh -X'
alias print-path='echo -e ${PATH//:/\\n}' alias print-path='echo -e ${PATH//:/\\n}'
alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty"
alias lsbom='lsbom -f -l -s -pf'
alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty"
if [[ -x "${commands[htop]}" ]]; then if [[ -x "${commands[htop]}" ]]; then
alias top=htop alias top=htop
@ -60,24 +56,38 @@ else
alias topc='top -o cpu' alias topc='top -o cpu'
fi fi
[[ "$DISABLE_COLOR" != 'true' ]] && { if [[ "$DISABLE_COLOR" != 'true' ]]; then
[[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' if [[ -x "${commands[colordiff]}" ]]; then
[[ -x "${commands[colormake]}" ]] && alias make='colormake' alias diff='colordiff'
} fi
if [[ -x "${commands[colormake]}" ]]; then
alias make='colormake'
fi
fi
# Screen # Terminal Multiplexer
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" local screenrc tmuxconf
[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" if [[ "$TERM" == 'xterm-color' ]]; then
if [[ -e "$HOME/.screenrc" ]]; then
screenrc="-c '$HOME/.screenrc'"
tmuxconf="-f '$HOME/.tmux.conf'"
fi
fi
if [[ "$TERM" == 'xterm-256color' ]]; then
if [[ -e "$HOME/.screenrc256" ]]; then
screenrc="-c '$HOME/.screenrc256'"
tmuxconf="-f '$HOME/.tmux256.conf'"
fi
fi
alias screen="screen $screenrc" alias screen="screen $screenrc"
alias sl="screen $screenrc -list" alias sl="screen $screenrc -list"
alias sr="screen $screenrc -a -A -U -D -R" alias sr="screen $screenrc -a -A -U -D -R"
alias S="screen $screenrc -U -S" 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 tmux="tmux $tmuxconf"
alias tls="tmux list-sessions" alias tls="tmux list-sessions"

@ -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 \

@ -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'

@ -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 ..'

@ -1,10 +1,10 @@
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 take() { function mkdcd() {
mkdir -p $1 mkdir -p "$1"
cd $1 cd "$1"
} }
function cdll() { function cdll() {
@ -30,12 +30,16 @@ function popdll() {
ls -lFhA ls -lFhA
} }
function grab() { function gown() {
sudo chown -R ${USER} ${1:-.} sudo chown -R "${USER}" "${1:-.}"
} }
function reload() { function reload() {
source "$HOME/.zshrc" local zshrc="$HOME/.zshrc"
if [[ -n "$1" ]]; then
zshrc="$1"
fi
source "$zshrc"
} }
function calc() { function calc() {
@ -43,14 +47,14 @@ function calc() {
} }
function pmine() { function pmine() {
ps $@ -u $USER -o pid,%cpu,%mem,command ps "$@" -u "$USER" -o pid,%cpu,%mem,command
} }
function findexec() { function findexec() {
find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; find . -type f -iname "*${1:-}*" -exec "${2:-file}" {} \;
} }
function httpserve() { function httpserve() {
python -m SimpleHTTPServer python -m SimpleHTTPServer "$@"
} }

@ -1,11 +1,21 @@
# get the name of the branch we are on # Renders the name of the current branch.
function git_prompt_info() { function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return local branch=$(git_current_branch)
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" 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 working tree is dirty # Checks if the working tree is dirty.
parse_git_dirty() { function parse_git_dirty() {
if [[ -n $(git status -s 2> /dev/null) ]]; then if [[ -n $(git status -s 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else else
@ -13,25 +23,31 @@ parse_git_dirty() {
fi fi
} }
# Checks if there are commits ahead from remote # Checks if there are commits ahead from remote.
function git_prompt_ahead() { function git_prompt_ahead() {
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD" echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
} }
# Formats prompt string for current git commit short SHA # Formats the prompt string for current git commit short SHA.
function git_prompt_short_sha() { function git_prompt_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" 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 prompt string for current git commit long SHA # Formats the prompt string for current git commit long SHA.
function git_prompt_long_sha() { function git_prompt_long_sha() {
SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" 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
} }
# Get the status of the working tree # Gets the status of the working tree.
git_prompt_status() { function git_prompt_status() {
local indicators line untracked added modified renamed deleted local indicators line untracked added modified renamed deleted
while IFS=$'\n' read line; do while IFS=$'\n' read line; do
if [[ "$line" =~ '^\?\? ' ]]; then if [[ "$line" =~ '^\?\? ' ]]; then
@ -61,3 +77,4 @@ git_prompt_status() {
done < <(git status --porcelain 2> /dev/null) done < <(git status --porcelain 2> /dev/null)
echo $indicators echo $indicators
} }

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

@ -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

@ -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'
#

@ -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

@ -1,7 +1,8 @@
# get the name of the branch we are on # Get the name of the current branch.
function rvm_prompt_info() { function rvm_prompt_info() {
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null)
echo "($ruby_version)" if [[ -n "$ruby_version" ]]; then
echo "($ruby_version)"
fi
} }

@ -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.
# 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

@ -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%<<"
} }

@ -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

@ -1,38 +1,39 @@
# 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
# Load all of the config files in ~/oh-my-zsh that end in .zsh # Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh.
# TIP: Add files you don't want in git to .gitignore for config_file in $ZSH/lib/*.zsh; do
for config_file ($ZSH/lib/*.zsh) source $config_file source "$config_file"
done
# Add all defined plugins to fpath # 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.
if [ "$ZSH_THEME" = "random" ] if [[ "$ZSH_THEME" == "random" ]]; then
then themes=($ZSH/themes/*.zsh-theme)
themes=($ZSH/themes/*zsh-theme) theme_index=${#themes[@]}
N=${#themes[@]} (( theme_index=((RANDOM % theme_index) + 1) ))
((N=(RANDOM%N)+1)) random_theme="${themes[$theme_index]}"
RANDOM_THEME=${themes[$N]} source "$random_theme"
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else else
if [ ! "$ZSH_THEME" = "" ] if [ ! "$ZSH_THEME" = "" ]
then then
@ -41,7 +42,7 @@ else
fi fi
# 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

@ -1,4 +1,3 @@
# Aliases
alias g='git' alias g='git'
compdef g=git compdef g=git
alias gst='git status' alias gst='git status'
@ -27,24 +26,12 @@ alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick compdef _git gcp=git-cherry-pick
alias glg='git log --stat --max-count=5' alias glg='git log --stat --max-count=5'
compdef _git glg=git-log compdef _git glg=git-log
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef git-svn-dcommit-push=git compdef git-svn-dcommit-push=git
alias ggpull='git pull origin $(git_current_branch)'
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
# these aliases take advantage of the previous function
alias ggpull='git pull origin $(current_branch)'
compdef ggpull=git compdef ggpull=git
alias ggpush='git push origin $(current_branch)' alias ggpush='git push origin $(git_current_branch)'
compdef ggpush=git compdef ggpush=git
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' alias ggpnp='git pull origin $(git_current_branch) && git push origin $(git_current_branch)'
compdef ggpnp=git compdef ggpnp=git

@ -1,25 +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'
# Uncomment following line if you want to disable colors in ls # Set to 'true' to disable color (auto set on dumb terminals).
# export DISABLE_COLOR="true" export DISABLE_COLOR='false'
# Uncomment following line if you want to disable autosetting terminal title. # Set to 'true' to disable auto setting the tab and window titles.
# export DISABLE_AUTO_TITLE="true" export DISABLE_AUTO_TITLE='false'
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Set the plugins to load (see $ZSH/plugins/).
# Example format: plugins=(rails git textmate ruby lighthouse) # Example: 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...

Loading…
Cancel
Save