commit
741388be00
50 changed files with 658 additions and 180 deletions
@ -1,5 +1,9 @@ |
||||
if [ -f /opt/local/etc/profile.d/autojump.sh ]; then |
||||
. /opt/local/etc/profile.d/autojump.sh |
||||
elif [ -f `brew --prefix`/etc/autojump ]; then |
||||
if [ $commands[autojump] ]; then # check if autojump is installed |
||||
if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package |
||||
. /usr/share/autojump/autojump.zsh |
||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation |
||||
. /etc/profile.d/autojump.zsh |
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew |
||||
. `brew --prefix`/etc/autojump |
||||
fi |
||||
fi |
||||
|
||||
@ -0,0 +1,20 @@ |
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then |
||||
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" } |
||||
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') } |
||||
function battery_pct_prompt() { |
||||
b=$(battery_pct_remaining) |
||||
if [ $b -gt 50 ] ; then |
||||
color='green' |
||||
elif [ $b -gt 20 ] ; then |
||||
color='yellow' |
||||
else |
||||
color='red' |
||||
fi |
||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" |
||||
} |
||||
else |
||||
error_msg='no battery' |
||||
function battery_pct_remaining() { echo $error_msg } |
||||
function battery_time_remaining() { echo $error_msg } |
||||
function battery_pct_prompt() { echo '' } |
||||
fi |
||||
@ -0,0 +1,14 @@ |
||||
#---oh-my-zsh plugin : task Autocomplete for Jake tool--- |
||||
# Jake : https://github.com/mde/jake |
||||
# Warning : Jakefile should have the right case : Jakefile or jakefile |
||||
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10 |
||||
# Author : Alexandre Lacheze (@al3xstrat) |
||||
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh |
||||
|
||||
function _jake () { |
||||
if [ -f Jakefile ]||[ -f jakefile ]; then |
||||
compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"` |
||||
fi |
||||
} |
||||
|
||||
compdef _jake jake |
||||
@ -1,14 +1,14 @@ |
||||
|
||||
# Mercurial |
||||
alias hgc='hg commit -v' |
||||
alias hgb='hg branch -v' |
||||
alias hgc='hg commit' |
||||
alias hgb='hg branch' |
||||
alias hgba='hg branches' |
||||
alias hgco='hg checkout' |
||||
alias hgd='hg diff' |
||||
alias hged='hg diffmerge' |
||||
# pull and update |
||||
alias hgl='hg pull -u -v' |
||||
alias hgp='hg push -v' |
||||
alias hgs='hg status -v' |
||||
alias hgl='hg pull -u' |
||||
alias hgp='hg push' |
||||
alias hgs='hg status' |
||||
# this is the 'git commit --amend' equivalent |
||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' |
||||
|
||||
@ -1,10 +1,66 @@ |
||||
# 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 |
||||
# Restart a rack app running under pow |
||||
# http://pow.cx/ |
||||
# |
||||
# Adds a kapow command that will restart an app |
||||
# |
||||
# $ kapow myapp |
||||
# |
||||
# Supports command completion. |
||||
# |
||||
# If you are not already using completion you might need to enable it with |
||||
# |
||||
# autoload -U compinit compinit |
||||
# |
||||
# Changes: |
||||
# |
||||
# Defaults to the current application, and will walk up the tree to find |
||||
# a config.ru file and restart the corresponding app |
||||
# |
||||
# Will Detect if a app does not exist in pow and print a (slightly) helpful |
||||
# error message |
||||
|
||||
rack_root_detect(){ |
||||
setopt chaselinks |
||||
local orgdir=$(pwd) |
||||
local basedir=$(pwd) |
||||
|
||||
while [[ $basedir != '/' ]]; do |
||||
test -e "$basedir/config.ru" && break |
||||
builtin cd ".." 2>/dev/null |
||||
basedir="$(pwd)" |
||||
done |
||||
|
||||
builtin cd $orgdir 2>/dev/null |
||||
[[ ${basedir} == "/" ]] && return 1 |
||||
echo `basename $basedir | sed -E "s/.(com|net|org)//"` |
||||
} |
||||
|
||||
kapow(){ |
||||
local vhost=$1 |
||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect) |
||||
if [ ! -h ~/.pow/$vhost ] |
||||
then |
||||
echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first." |
||||
return 1 |
||||
fi |
||||
|
||||
[ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp |
||||
touch ~/.pow/$vhost/tmp/restart.txt; |
||||
[ $? -eq 0 ] && echo "pow: restarting $vhost.dev" |
||||
} |
||||
compctl -W ~/.pow -/ kapow |
||||
|
||||
powit(){ |
||||
local basedir=$(pwd) |
||||
local vhost=$1 |
||||
[ ! -n "$vhost" ] && vhost=$(rack_root_detect) |
||||
if [ ! -h ~/.pow/$vhost ] |
||||
then |
||||
echo "pow: Symlinking your app with pow. ${vhost}" |
||||
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost |
||||
return 1 |
||||
fi |
||||
} |
||||
|
||||
# View the standard out (puts) from any pow app |
||||
alias kaput="tail -f ~/Library/Logs/Pow/apps/*" |
||||
|
||||
@ -0,0 +1,6 @@ |
||||
alias rake="noglob rake" # allows square brackts for rake task invocation |
||||
alias brake='noglob bundle exec rake' # execute the bundled rake gem |
||||
alias srake='noglob sudo rake' # noglob must come before sudo |
||||
alias sbrake='noglob sudo bundle exec rake' # altogether now ... |
||||
|
||||
|
||||
@ -0,0 +1,44 @@ |
||||
FOUND_RBENV=0 |
||||
for rbenvdir in "$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" ; do |
||||
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then |
||||
FOUND_RBENV=1 |
||||
export RBENV_ROOT=$rbenvdir |
||||
export PATH=${rbenvdir}/bin:$PATH |
||||
eval "$(rbenv init -)" |
||||
|
||||
alias rubies="rbenv versions" |
||||
alias gemsets="rbenv gemset list" |
||||
|
||||
function current_ruby() { |
||||
echo "$(rbenv version-name)" |
||||
} |
||||
|
||||
function current_gemset() { |
||||
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" |
||||
} |
||||
|
||||
function gems { |
||||
local rbenv_path=$(rbenv prefix) |
||||
gem list $@ | sed \ |
||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ |
||||
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_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" |
||||
} |
||||
|
||||
function rbenv_prompt_info() { |
||||
if [[ -n $(current_gemset) ]] ; then |
||||
echo "$(current_ruby)@$(current_gemset)" |
||||
else |
||||
echo "$(current_ruby)" |
||||
fi |
||||
} |
||||
fi |
||||
done |
||||
unset rbenvdir |
||||
|
||||
if [ $FOUND_RBENV -eq 0 ] ; then |
||||
alias rubies='ruby -v' |
||||
function gemsets() { echo 'not supported' } |
||||
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" } |
||||
fi |
||||
@ -0,0 +1,64 @@ |
||||
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail> |
||||
# Created by the blogger at the URL below...I don't know where to find his/her name |
||||
# Original found at http://www.shellperson.net/sprunge-pastebin-script/ |
||||
|
||||
usage() { |
||||
description | fmt -s >&2 |
||||
} |
||||
|
||||
description() { |
||||
cat << HERE |
||||
|
||||
DESCRIPTION |
||||
Upload data and fetch URL from the pastebin http://sprunge.us |
||||
|
||||
USAGE |
||||
$0 filename.txt |
||||
$0 text string |
||||
$0 < filename.txt |
||||
piped_data | $0 |
||||
|
||||
NOTES |
||||
-------------------------------------------------------------------------- |
||||
* INPUT METHODS * |
||||
$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code. |
||||
|
||||
* PRECEDENCE * |
||||
STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments. |
||||
|
||||
EXAMPLE: |
||||
echo piped | "$0" arguments.txt < stdin_redirection.txt |
||||
|
||||
In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded. |
||||
|
||||
* FILENAMES * |
||||
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it. |
||||
-------------------------------------------------------------------------- |
||||
|
||||
HERE |
||||
exit |
||||
} |
||||
|
||||
sprunge() { |
||||
if [ -t 0 ]; then |
||||
echo Running interactively, checking for arguments... >&2 |
||||
if [ "$*" ]; then |
||||
echo Arguments present... >&2 |
||||
if [ -f "$*" ]; then |
||||
echo Uploading the contents of "$*"... >&2 |
||||
cat "$*" |
||||
else |
||||
echo Uploading the text: \""$*"\"... >&2 |
||||
echo "$*" |
||||
fi | curl -F 'sprunge=<-' http://sprunge.us |
||||
else |
||||
echo No arguments found, printing USAGE and exiting. >&2 |
||||
usage |
||||
fi |
||||
else |
||||
echo Using input from a pipe or STDIN redirection... >&2 |
||||
while read -r line ; do |
||||
echo $line |
||||
done | curl -F 'sprunge=<-' http://sprunge.us |
||||
fi |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
# Symfony2 basic command completion |
||||
|
||||
_symfony2_get_command_list () { |
||||
app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' |
||||
} |
||||
|
||||
_symfony2 () { |
||||
if [ -f app/console ]; then |
||||
compadd `_symfony2_get_command_list` |
||||
fi |
||||
} |
||||
|
||||
compdef _symfony2 app/console |
||||
@ -0,0 +1,11 @@ |
||||
# Set Apple Terminal.app resume directory |
||||
# based on this answer: http://superuser.com/a/315029 |
||||
|
||||
function chpwd { |
||||
local SEARCH=' ' |
||||
local REPLACE='%20' |
||||
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" |
||||
printf '\e]7;%s\a' "$PWD_URL" |
||||
} |
||||
|
||||
chpwd |
||||
@ -0,0 +1,24 @@ |
||||
# mh theme |
||||
# preview: http://cl.ly/1y2x0W0E3t2C0F29043z |
||||
|
||||
# features: |
||||
# path is autoshortened to ~30 characters |
||||
# displays git status (if applicable in current folder) |
||||
# turns username green if superuser, otherwise it is white |
||||
|
||||
# if superuser make the username green |
||||
if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi |
||||
|
||||
# prompt |
||||
PROMPT='[%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) ' |
||||
RPROMPT='$(git_prompt_info)' |
||||
|
||||
# git theming |
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} " |
||||
ZSH_THEME_GIT_PROMPT_CLEAN="" |
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱" |
||||
|
||||
# LS colors, made with http://geoff.greer.fm/lscolors/ |
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad" |
||||
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' |
||||
@ -0,0 +1,58 @@ |
||||
function my_git_prompt() { |
||||
tester=$(git rev-parse --git-dir 2> /dev/null) || return |
||||
|
||||
INDEX=$(git status --porcelain 2> /dev/null) |
||||
STATUS="" |
||||
|
||||
# is branch ahead? |
||||
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then |
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" |
||||
fi |
||||
|
||||
# is anything staged? |
||||
if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then |
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" |
||||
fi |
||||
|
||||
# is anything unstaged? |
||||
if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then |
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" |
||||
fi |
||||
|
||||
# is anything untracked? |
||||
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then |
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" |
||||
fi |
||||
|
||||
# is anything unmerged? |
||||
if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then |
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" |
||||
fi |
||||
|
||||
if [[ -n $STATUS ]]; then |
||||
STATUS=" $STATUS" |
||||
fi |
||||
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" |
||||
} |
||||
|
||||
function my_current_branch() { |
||||
echo $(current_branch || echo "(no branch)") |
||||
} |
||||
|
||||
function ssh_connection() { |
||||
if [[ -n $SSH_CONNECTION ]]; then |
||||
echo "%{$fg_bold[red]%}(ssh) " |
||||
fi |
||||
} |
||||
|
||||
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# ' |
||||
|
||||
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}" |
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}" |
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑" |
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●" |
||||
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●" |
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●" |
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}" |
||||
@ -0,0 +1,6 @@ |
||||
PROMPT='%{$fg[white]%}%c$(git_prompt_info)$ % %{$reset_color%}' |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="(" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="" |
||||
ZSH_THEME_GIT_PROMPT_DIRTY="*)" |
||||
ZSH_THEME_GIT_PROMPT_CLEAN=")" |
||||
@ -1,12 +1,19 @@ |
||||
current_path=`pwd` |
||||
echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m" |
||||
( cd $ZSH && git pull origin master ) |
||||
echo -e "\033[0;32m"' __ __ '"\033[0m" |
||||
echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
||||
echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
||||
echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
||||
echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
||||
echo -e "\033[0;32m"' /____/ '"\033[0m" |
||||
echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" |
||||
echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" |
||||
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" |
||||
cd $ZSH |
||||
|
||||
if git pull origin master |
||||
then |
||||
printf '\033[0;32m%s\033[0m\n' ' __ __ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' |
||||
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' |
||||
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' |
||||
printf '\033[0;32m%s\033[0m\n' ' /____/ ' |
||||
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' |
||||
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' |
||||
else |
||||
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' |
||||
fi |
||||
|
||||
cd "$current_path" |
||||
Loading…
Reference in new issue