Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
commit
f504102584
38 changed files with 495 additions and 90 deletions
@ -1,3 +1,5 @@ |
|||||||
if [ -f `brew --prefix`/etc/autojump ]; then |
if [ -f /opt/local/etc/profile.d/autojump.sh ]; then |
||||||
|
. /opt/local/etc/profile.d/autojump.sh |
||||||
|
elif [ -f `brew --prefix`/etc/autojump ]; then |
||||||
. `brew --prefix`/etc/autojump |
. `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 |
||||||
@ -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,29 @@ |
|||||||
|
This plugin provides a wrapper around the "wakeonlan" tool available from most |
||||||
|
distributions' package repositories, or from the following website: |
||||||
|
|
||||||
|
http://gsd.di.uminho.pt/jpo/software/wakeonlan/ |
||||||
|
|
||||||
|
In order to use this wrapper, create the ~/.wakeonlan directory, and place in |
||||||
|
that directory one file for each device you would like to be able to wake. Give |
||||||
|
the file a name that describes the device, such as its hostname. Each file |
||||||
|
should contain a line with the mac address of the target device and the network |
||||||
|
broadcast address. |
||||||
|
|
||||||
|
For instance, there might be a file ~/.wakeonlan/leto with the following |
||||||
|
contents: |
||||||
|
|
||||||
|
00:11:22:33:44:55:66 192.168.0.255 |
||||||
|
|
||||||
|
To wake that device, use the following command: |
||||||
|
|
||||||
|
# wake leto |
||||||
|
|
||||||
|
The available device names will be autocompleted, so: |
||||||
|
|
||||||
|
# wake <tab> |
||||||
|
|
||||||
|
...will suggest "leto", along with any other configuration files that were |
||||||
|
placed in the ~/.wakeonlan directory. |
||||||
|
|
||||||
|
For more information regarding the configuration file format, check the |
||||||
|
wakeonlan man page. |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
#compdef wake |
||||||
|
#autoload |
||||||
|
|
||||||
|
_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0 |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
function wake() { |
||||||
|
local config_file="$HOME/.wakeonlan/$1" |
||||||
|
if [[ ! -f "$config_file" ]]; then |
||||||
|
echo "ERROR: There is no configuration file at \"$config_file\"." |
||||||
|
return 1 |
||||||
|
fi |
||||||
|
|
||||||
|
if (( ! $+commands[wakeonlan] )); then |
||||||
|
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?" |
||||||
|
return 1 |
||||||
|
fi |
||||||
|
|
||||||
|
wakeonlan -f "$config_file" |
||||||
|
} |
||||||
@ -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,9 @@ |
|||||||
|
# Yay! High voltage and arrows! |
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " |
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="" |
||||||
|
|
||||||
|
PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$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=")" |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
function prompt_char { |
||||||
|
git branch >/dev/null 2>/dev/null && echo '±' && return |
||||||
|
hg root >/dev/null 2>/dev/null && echo 'Hg' && return |
||||||
|
echo '○' |
||||||
|
} |
||||||
|
|
||||||
|
function virtualenv_info { |
||||||
|
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' |
||||||
|
} |
||||||
|
|
||||||
|
function collapse_pwd { |
||||||
|
echo $(pwd | sed -e "s,^$HOME,~,") |
||||||
|
} |
||||||
|
|
||||||
|
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} |
||||||
|
$(virtualenv_info)$(prompt_char) ' |
||||||
|
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" |
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" |
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="" |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' |
||||||
|
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' |
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" |
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
||||||
@ -1,12 +1,12 @@ |
|||||||
current_path=`pwd` |
current_path=`pwd` |
||||||
echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m" |
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" |
||||||
( cd $ZSH && git pull origin master ) |
( cd $ZSH && git pull origin master ) |
||||||
echo -e "\033[0;32m"' __ __ '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' ' __ __ ' |
||||||
echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' |
||||||
echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' |
||||||
echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' |
||||||
echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' |
||||||
echo -e "\033[0;32m"' /____/ '"\033[0m" |
printf '\033[0;32m%s\033[0m\n' ' /____/ ' |
||||||
echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" |
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' |
||||||
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[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' |
||||||
cd "$current_path" |
cd "$current_path" |
||||||
|
|||||||
Loading…
Reference in new issue