finally merged with upstream

This commit is contained in:
Mike Hostetler 2011-03-16 14:56:04 -05:00
commit 23496fa683
90 changed files with 2442 additions and 270 deletions

View file

@ -1,53 +0,0 @@
#!/bin/zsh
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
alias ss='thin --stats "/thin/stats" start'
alias sg='ruby script/generate'
alias sd='ruby script/destroy'
alias sp='ruby script/plugin'
alias ssp='ruby script/spec'
alias rdbm='rake db:migrate'
alias sc='ruby script/console'
alias sd='ruby script/server --debugger'
alias devlog='tail -f log/development.log'
# Basic directory operations
alias .='pwd'
alias ...='cd ../..'
alias -- -='cd -'
# Super user
alias _='sudo'
alias ss='sudo su -'
#alias g='grep -in'
# Show history
alias history='fc -l 1'
# List direcory contents
alias lsa='ls -lah'
alias l='ls -la'
alias ll='ls -alr'
alias sl=ls # often screw this up
alias sgem='sudo gem'
# Find ruby file
alias rfind='find . -name *.rb | xargs grep -n'
alias afind='ack-grep -il'
# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
# 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'

View file

@ -1,7 +1,6 @@
# ls colors
autoload colors; colors;
export LSCOLORS="Gxfxcxdxbxegedabagacad"
#export LS_COLORS
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]

View file

@ -1,19 +1,17 @@
## fixme - the load process here seems a bit bizarre
# fixme - the load process here seems a bit bizarre
setopt noautomenu
unsetopt noautomenu
setopt complete_in_word
setopt always_to_end
unsetopt flowcontrol
unsetopt always_to_end
WORDCHARS=''
autoload -U compinit
compinit
compinit -i
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
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
unset CASE_SENSITIVE
@ -23,27 +21,42 @@ fi
zstyle ':completion:*' list-colors ''
unsetopt MENU_COMPLETE
#setopt AUTO_MENU
# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle ':completion:*:*:*:*:*' menu yes select
# zstyle ':completion:*:*:*:*:processes' force-list always
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"
# Load known hosts file for auto-completion with ssh and scp commands
if [ -f ~/.ssh/known_hosts ]; then
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
fi
# 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
[ -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=(
"$_ssh_hosts[@]"
"$_etc_hosts[@]"
`hostname`
localhost
)
zstyle ':completion:*:hosts' hosts $hosts
# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
# 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 \
hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
mailman mailnull mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
# ... unless we really want to.
zstyle '*' single-ignored show
# Complete on history
#zstyle ':completion:*:history-words' stop yes
#zstyle ':completion:*:history-words' remove-all-dups yes
#zstyle ':completion:*:history-words' list false
#zstyle ':completion:*:history-words' menu yes

View file

@ -4,5 +4,3 @@ alias man='nocorrect man'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'

View file

@ -3,23 +3,17 @@ setopt auto_name_dirs
setopt auto_pushd
setopt pushd_ignore_dups
alias -- -='cd -'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias cd/='cd /'
alias 1='cd -'
alias 2='cd +2'
alias 3='cd +3'
alias 4='cd +4'
alias 5='cd +5'
alias 6='cd +6'
alias 7='cd +7'
alias 8='cd +8'
alias 9='cd +9'
cd () {
if [[ "x$*" == "x..." ]]; then
cd ../..
@ -37,4 +31,16 @@ cd () {
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v'
alias d='dirs -v'
# List direcory contents
alias l1='tree --dirsfirst -ChFL 1'
alias l2='tree --dirsfirst -ChFL 2'
alias l3='tree --dirsfirst -ChFL 3'
alias ll1='tree --dirsfirst -ChFupDaL 1'
alias ll2='tree --dirsfirst -ChFupDaL 2'
alias ll3='tree --dirsfirst -ChFupDaL 3'
alias l='l1'
alias ll='ll1'

View file

@ -1,6 +1,37 @@
<<<<<<< HEAD
=======
alias pm='python manage.py'
>>>>>>> upstream/master
alias pmr='python manage.py runserver'
alias pmrp='python manage.py runserver_plus'
alias pmrpg='pmrp --adminmedia=`pwd`/media/admin'
alias pmsdb='python manage.py syncdb'
alias pms='python manage.py shell'
<<<<<<< HEAD
alias pmlf='python manage.py loaddata fixtures/*'
=======
alias pmsp='python manage.py shell_plus'
alias pmlf='python manage.py loaddata fixtures/*'
alias pmt='python -W ignore::DeprecationWarning manage.py test'
alias pmdm='python manage.py datamigration'
alias pmsm='python manage.py schemamigration --auto'
alias pmsi='python manage.py schemamigration --initial'
alias pmm='python manage.py migrate'
alias pmma='python manage.py migrate --all'
alias pmml='python manage.py migrate --list'
alias pmmf='python manage.py migrate --fake'
alias pmcats='python manage.py convert_to_south'
alias gs='gunicorn_django'
alias gk='kill `cat .gunicorn.pid`'
alias gl='tail -f .gunicorn.log'
function djapp() {
mkdir -p $1/templates/$1
touch $1/__init__.py
echo "from django.db import models\n\n" > $1/models.py
echo "from django.contrib import admin\nfrom $1.models import *\n\n" > $1/admin.py
echo "from django.conf.urls.defaults import *\n\n" > $1/urls.py
}
>>>>>>> upstream/master

View file

@ -1,30 +1,3 @@
## fixme, i duplicated this in xterms - oops
function title {
if [[ $TERM == "screen" ]]; then
# Use these two for GNU Screen:
print -nR $'\033k'$1$'\033'\\\
print -nR $'\033]0;'$2$'\a'
elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
# Use this one instead for XTerms:
print -nR $'\033]0;'$*$'\a'
fi
}
function precmd {
title zsh "$PWD"
}
function preexec {
emulate -L zsh
local -a cmd; cmd=(${(z)1})
title $cmd[1]:t "$cmd[2,-1]"
}
function remote_console() {
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
}
function zsh_stats() {
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
}
@ -36,42 +9,3 @@ function uninstall_oh_my_zsh() {
function upgrade_oh_my_zsh() {
/bin/sh $ZSH/tools/upgrade.sh
}
function tab() {
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "cd \"$PWD\"; $*" in window 1
end tell
EOF
}
function take() {
mkdir -p $1
cd $1
}
function tm() {
cd $1
mate $1
}
# To use: add a .lighthouse file into your directory with the URL to the
# individual project. For example:
# https://rails.lighthouseapp.com/projects/8994
# Example usage: http://screencast.com/t/ZDgwNDUwNT
open_lighthouse_ticket () {
if [ ! -f .lighthouse-url ]; then
echo "There is no .lighthouse file in the current directory..."
return 0;
else
lighthouse_url=$(cat .lighthouse-url);
echo "Opening ticket #$1";
`open $lighthouse_url/tickets/$1`;
fi
}
alias lho='open_lighthouse_ticket'

View file

@ -5,10 +5,18 @@ function git_prompt_info() {
}
parse_git_dirty () {
if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY"
fi
if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if [[ $(echo ${gitstat} | grep -v '^$' | wc -l | tr -d ' ') == 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
@ -21,17 +29,29 @@ function current_branch() {
echo ${ref#refs/heads/}
}
# Aliases
alias g='git'
alias gst='git status'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gd='git diff | mate'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
# get the status of the working tree
git_prompt_status() {
INDEX=$(git status --porcelain 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi
if $(echo "$INDEX" | grep '^R ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
fi
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi
echo $STATUS
}

View file

@ -1,6 +0,0 @@
#
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'

View file

@ -10,5 +10,11 @@ setopt hist_verify
setopt inc_append_history
setopt extended_history
setopt hist_expire_dups_first
<<<<<<< HEAD
=======
setopt hist_ignore_space
setopt SHARE_HISTORY
>>>>>>> upstream/master
setopt APPEND_HISTORY

View file

@ -1,6 +1,6 @@
# TODO: Explain what some of this does..
autoload -U compinit
compinit
compinit -i
bindkey -e
bindkey '\ew' kill-region
@ -23,22 +23,4 @@ bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line
bindkey ' ' magic-space # also do history expansion on space
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#
bindkey '^[[Z' reverse-menu-complete

View file

@ -3,11 +3,60 @@ autoload -U url-quote-magic
zle -N self-insert url-quote-magic
## file rename magick
autoload -U zmv
bindkey "^[m" copy-prev-shell-word
## jobs
setopt long_list_jobs
## pager
export PAGER=less
export PAGER='less -R'
export LC_CTYPE=en_US.UTF-8
## pretty man pages
function pman() {
man $1 -t | open -f -a Preview
}
## pretty JSON
function pj() {
python -mjson.tool
}
## curl JSON
function cj() {
curl -sS $@ | pj
}
## Open current directory
alias oo='open .'
## Quick-look a file (^C to close)
alias ql='qlmanage -p 2>/dev/null'
## Start a local SMTP server and dump emails sent to it to the console
alias smtpconsole='python -m smtpd -n -c DebuggingServer localhost:1025'
## Serve the current folder on port 80
alias serve_this='python -m SimpleHTTPServer'
## Highlight-aware less command
alias hl='less -R'
## Show history
alias history='fc -l 1'
## Color grep results
## Examples: http://rubyurl.com/ZXv
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'
# What the hell did I do the other day?
function whatthehelldididoon() {
for repo in `find . -name '.hg'`
do
echo $repo
hg .. -R $repo/.. -d "$1" -u 'Steve Losh'
done
}

13
lib/python.zsh Normal file
View file

@ -0,0 +1,13 @@
function wo() {
[ "$VEW_SOURCED" ] || source "$VEW_PATH"
[ -f './.venv' ] && workon `cat ./.venv` || workon $1
export VEW_SOURCED=1
}
alias deact='deactivate'
alias cdv='cd $WORKON_HOME'
function cdp () {
cd "$(python -c "import os.path as _, ${1}; \
print _.dirname(_.realpath(${1}.__file__[:-1]))"
)"
}

View file

@ -1,42 +0,0 @@
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks~ ]; then return 0;
else
accurate=$(stat -f%m .rake_tasks~)
changed=$(stat -f%m Rakefile)
return $(expr $accurate '>=' $changed)
fi
}
_rake () {
if [ -f Rakefile ]; then
if _rake_does_task_list_need_generating; then
echo "\nGenerating .rake_tasks~..." > /dev/stderr
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
fi
compadd `cat .rake_tasks~`
fi
}
compctl -K _rake rake
function _cap_does_task_list_need_generating () {
if [ ! -f .cap_tasks~ ]; then return 0;
else
accurate=$(stat -f%m .cap_tasks~)
changed=$(stat -f%m config/deploy.rb)
return $(expr $accurate '>=' $changed)
fi
}
function _cap () {
if [ -f config/deploy.rb ]; then
if _cap_does_task_list_need_generating; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
> .cap_tasks~
fi
compadd `cat .cap_tasks~`
fi
}
compctl -K _cap cap

2
lib/redis.zsh Normal file
View file

@ -0,0 +1,2 @@
alias res='./redis-server'
alias rec='./redis-cli'

20
lib/spectrum.zsh Normal file
View file

@ -0,0 +1,20 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# 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 "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done

2
lib/supervisord.zsh Normal file
View file

@ -0,0 +1,2 @@
alias ssd='sudo supervisord'
alias ssc='sudo supervisorctl'

View file

@ -1,21 +0,0 @@
case "$TERM" in
xterm*|rxvt*)
preexec () {
print -Pn "\e]0;%n@%m: $1\a" # xterm
}
precmd () {
print -Pn "\e]0;%n@%m: %~\a" # xterm
}
;;
screen*)
preexec () {
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
echo -ne "\ek$CMD\e\\"
print -Pn "\e]0;%n@%m: $1\a" # xterm
}
precmd () {
echo -ne "\ekzsh\e\\"
print -Pn "\e]0;%n@%m: %~\a" # xterm
}
;;
esac