Created
April 8, 2010 16:05
-
-
Save jjcall/360221 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) | |
if [[ -n $ref ]]; then | |
echo "[%{$fg_bold[green]%}${ref#refs/heads/}%{$reset_color%}]" | |
fi | |
} | |
# makes color constants available | |
autoload -U colors | |
colors | |
# enable colored output from ls, etc | |
export CLICOLOR=1 | |
# expand functions in the prompt | |
setopt prompt_subst | |
# prompt | |
export PS1='$(git_prompt_info)[${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%~%{$reset_color%}] ' | |
# autocompletion for ruby_test | |
# works with tu/tf aliases | |
_ruby_tests() { | |
if [[ -n $words[2] ]]; then | |
compadd `ruby_test -l ${words[2]}` | |
fi | |
} | |
compdef _ruby_tests ruby_test | |
# autocompletion for ruby_tu_rs | |
# works with su/sf aliases | |
_ruby_mixed_tests() { | |
if [[ -n $words[2] ]]; then | |
compadd `ruby_tu_rs -l ${words[2]}` | |
fi | |
} | |
compdef _ruby_mixed_tests ruby_tu_rs | |
_git_remote_branch() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) | |
if [[ -n $ref ]]; then | |
if (( CURRENT == 2 )); then | |
# first arg: operation | |
compadd create publish rename delete track | |
elif (( CURRENT == 3 )); then | |
# second arg: remote branch name | |
compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"` | |
elif (( CURRENT == 4 )); then | |
# third arg: remote name | |
compadd `git remote` | |
fi | |
else; | |
_files | |
fi | |
} | |
compdef _git_remote_branch grb | |
# autocompletion for schema | |
_rails_tables() { | |
if [[ -n $words[2] ]]; then | |
compadd `schema -l ${words[2]}` | |
fi | |
} | |
compdef _rails_tables schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/android/tools:$PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# completion | |
autoload -U compinit | |
compinit | |
# automatically enter directories without cd | |
setopt auto_cd | |
# use vim as an editor | |
export EDITOR=vim | |
# aliases | |
if [ -e "$HOME/.aliases" ]; then | |
source "$HOME/.aliases" | |
fi | |
# vi mode | |
bindkey -v | |
# use incremental search | |
bindkey ^R history-incremental-search-backward | |
# expand functions in the prompt | |
setopt prompt_subst | |
# prompt | |
export PS1='[${SSH_CONNECTION+"%n@%m:"}%~] ' | |
# ignore duplicate history entries | |
setopt histignoredups | |
# keep more history | |
export HISTSIZE=200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment