Merge pull request #2 from robbyrussell/master

updating
This commit is contained in:
Josh Price 2013-02-02 15:19:13 -08:00
commit 33a2cecaf5
17 changed files with 111 additions and 35 deletions

21
MIT-LICENSE.txt Normal file
View file

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2009-2013 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -9,13 +9,15 @@ function git_prompt_info() {
# Checks if working tree is dirty # Checks if working tree is dirty
parse_git_dirty() { parse_git_dirty() {
local SUBMODULE_SYNTAX='' local SUBMODULE_SYNTAX=''
if [[ $POST_1_7_2_GIT -gt 0 ]]; then if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty" if [[ $POST_1_7_2_GIT -gt 0 ]]; then
fi SUBMODULE_SYNTAX="--ignore-submodules=dirty"
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then fi
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
else echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
echo "$ZSH_THEME_GIT_PROMPT_CLEAN" else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
fi fi
} }
@ -85,6 +87,9 @@ git_prompt_status() {
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
fi fi
if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
fi
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
fi fi
@ -102,7 +107,7 @@ git_prompt_status() {
#compare the provided version of git to the version installed and on path #compare the provided version of git to the version installed and on path
#prints 1 if input version <= installed version #prints 1 if input version <= installed version
#prints -1 otherwise #prints -1 otherwise
function git_compare_version() { function git_compare_version() {
local INPUT_GIT_VERSION=$1; local INPUT_GIT_VERSION=$1;
local INSTALLED_GIT_VERSION local INSTALLED_GIT_VERSION

View file

@ -8,8 +8,6 @@ function title {
fi fi
if [[ "$TERM" == screen* ]]; then if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)

View file

@ -56,6 +56,7 @@ done
for config_file ($ZSH_CUSTOM/*.zsh(N)); do for config_file ($ZSH_CUSTOM/*.zsh(N)); do
source $config_file source $config_file
done done
unset config_file
# Load the theme # Load the theme
if [ "$ZSH_THEME" = "random" ] if [ "$ZSH_THEME" = "random" ]

View file

@ -6,7 +6,7 @@ alias bu="bundle update"
# The following is based on https://github.com/gma/bundler-exec # The following is based on https://github.com/gma/bundler-exec
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma) bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus)
## Functions ## Functions
@ -33,6 +33,7 @@ _run-with-bundler() {
## Main program ## Main program
for cmd in $bundled_commands; do for cmd in $bundled_commands; do
eval "function unbundled_$cmd () { $cmd \$@ }"
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
alias $cmd=bundled_$cmd alias $cmd=bundled_$cmd

View file

@ -0,0 +1,13 @@
#
# Requires http://www.bruji.com/bwana/
#
if [[ -e /Applications/Bwana.app ]] ||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
then
function man() {
open "man:$1"
}
else
echo "Bwana lets you read man files in Safari through a man: URI scheme"
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
fi

View file

@ -1,2 +1,4 @@
encode64(){ echo -n $1 | base64 } encode64(){ echo -n $1 | base64 }
decode64(){ echo -n $1 | base64 -D } decode64(){ echo -n $1 | base64 -D }
alias e64=encode64
alias d64=decode64

View file

@ -237,13 +237,13 @@ __git-flow-feature ()
(diff) (diff)
_arguments \ _arguments \
':branch:__git_branch_names'\ ':branch:__git_flow_feature_list'\
;; ;;
(rebase) (rebase)
_arguments \ _arguments \
-i'[Do an interactive rebase]' \ -i'[Do an interactive rebase]' \
':branch:__git_branch_names' ':branch:__git_flow_feature_list'
;; ;;
(checkout) (checkout)
@ -254,7 +254,7 @@ __git-flow-feature ()
(pull) (pull)
_arguments \ _arguments \
':remote:__git_remotes'\ ':remote:__git_remotes'\
':branch:__git_branch_names' ':branch:__git_flow_feature_list'
;; ;;
*) *)
@ -334,4 +334,4 @@ __git_command_successful () {
return 0 return 0
} }
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'

View file

@ -19,6 +19,18 @@ compdef _git gca=git-commit
alias gco='git checkout' alias gco='git checkout'
compdef _git gco=git-checkout compdef _git gco=git-checkout
alias gcm='git checkout master' alias gcm='git checkout master'
alias gr='git remote'
compdef _git gr=git-remote
alias grv='git remote -v'
compdef _git grv=git-remote
alias grmv='git remote rename'
compdef _git grmv=git-remote
alias grrm='git remote remove'
compdef _git grrm=git-remote
alias grset='git remote set-url'
compdef _git grset=git-remote
alias grup='git remote update'
compdef _git grset=git-remote
alias gb='git branch' alias gb='git branch'
compdef _git gb=git-branch compdef _git gb=git-branch
alias gba='git branch -a' alias gba='git branch -a'

View file

@ -170,7 +170,11 @@ _chef_environments_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() { _chef_cookbooks_local() {
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) local knife_rb="$HOME/.chef/knife.rb"
if [ -f ./.chef/knife.rb ]; then
knife_rb="./.chef/knife.rb"
fi
(for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
} }
# This function extracts the available cookbook versions on the chef server # This function extracts the available cookbook versions on the chef server

View file

@ -5,15 +5,29 @@ function _lein_commands() {
case $state in case $state in
subcommand) subcommand)
subcommands=( subcommands=(
"classpath:print the classpath of the current project"
"clean:remove compiled files and dependencies from project" "clean:remove compiled files and dependencies from project"
"compile:ahead-of-time compile the project" "compile:ahead-of-time compile the project"
"deploy:build jar and deploy to remote repository"
"deps:download and install all dependencies" "deps:download and install all dependencies"
"help:display a list of tasks or help for a given task" "help:display a list of tasks or help for a given task"
"install:install the project and its dependencies in your local repository" "install:install the project and its dependencies in your local repository"
"int:enter an interactive task shell"
"interactive:enter an interactive task shell"
"jack-in:jack in to a clojure slime session from emacs."
"jar:create a jar file containing the compiled .class files" "jar:create a jar file containing the compiled .class files"
"javac:compile java source files"
"new:create a new project skeleton" "new:create a new project skeleton"
"plugin:manage user-level plugins"
"pom:write a pom.xml file to disk for maven interop" "pom:write a pom.xml file to disk for maven interop"
"repl:start a repl session either with the current project or standalone"
"retest:run only the test namespaces which failed last time around"
"run:run the project's -main function"
"search:search remote maven repositories for matching jars"
"swank:launch swank server for Emacs to connect"
"test:run the project's tests" "test:run the project's tests"
"test!:run a project's tests after cleaning and fetching dependencies"
"trampoline:run a task without nesting the project's JVM inside Leiningen's."
"uberjar:Create a jar including the contents of each of deps" "uberjar:Create a jar including the contents of each of deps"
"upgrade:upgrade leiningen to the latest stable release" "upgrade:upgrade leiningen to the latest stable release"
"version:print leiningen's version" "version:print leiningen's version"

View file

@ -5,6 +5,7 @@ alias wtf='dmesg'
alias onoz='cat /var/log/errors.log' alias onoz='cat /var/log/errors.log'
alias rtfm='man' alias rtfm='man'
alias :3='echo'
alias visible='echo' alias visible='echo'
alias invisible='cat' alias invisible='cat'
alias moar='more' alias moar='more'

View file

@ -6,6 +6,7 @@ alias sr='ruby script/runner'
alias ssp='ruby script/spec' alias ssp='ruby script/spec'
alias rdbm='rake db:migrate' alias rdbm='rake db:migrate'
alias rdbtp='rake db:test:prepare' alias rdbtp='rake db:test:prepare'
alias migrate='rake db:migrate && rake db:test:prepare'
alias sc='ruby script/console' alias sc='ruby script/console'
alias sd='ruby script/server --debugger' alias sd='ruby script/server --debugger'
alias devlog='tail -f log/development.log' alias devlog='tail -f log/development.log'

View file

@ -57,8 +57,6 @@ sprunge() {
fi fi
else else
echo Using input from a pipe or STDIN redirection... >&2 echo Using input from a pipe or STDIN redirection... >&2
while read -r line ; do curl -F 'sprunge=<-' http://sprunge.us
echo $line
done | curl -F 'sprunge=<-' http://sprunge.us
fi fi
} }

View file

@ -3,18 +3,13 @@
function zle-keymap-select zle-line-init zle-line-finish { function zle-keymap-select zle-line-init zle-line-finish {
# The terminal must be in application mode when ZLE is active for $terminfo # The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid. # values to be valid.
if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then if (( ${+terminfo[smkx]} )); then
case "$0" in printf '%s' ${terminfo[smkx]}
(zle-line-init)
# Enable terminal application mode.
echoti smkx
;;
(zle-line-finish)
# Disable terminal application mode.
echoti rmkx
;;
esac
fi fi
if (( ${+terminfo[rmkx]} )); then
printf '%s' ${terminfo[rmkx]}
fi
zle reset-prompt zle reset-prompt
zle -R zle -R
} }

View file

@ -95,7 +95,7 @@ prompt_dir() {
prompt_status() { prompt_status() {
local symbols local symbols
symbols=() symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}$RETVAL" [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"

View file

@ -8,13 +8,23 @@ function _prompt_char() {
fi fi
} }
# This theme works with both the "dark" and "light" variants of the
# Solarized color schema. Set the SOLARIZED_THEME variable to one of
# these two values to choose. If you don't specify, we'll assume you're
# using the "dark" variant.
case ${SOLARIZED_THEME:-dark} in
light) bkg=white;;
*) bkg=black;;
esac
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}" ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]" ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{%f%k%b%} PROMPT='%{%f%k%b%}
%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%} %{%K{${bkg}}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{${bkg}}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%}
%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} ' %{%K{${bkg}}%}$(_prompt_char)%{%K{${bkg}}%} %#%{%f%k%b%} '
RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}' RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}'