This commit is contained in:
Frederik Mogensen 2013-04-15 16:10:56 +02:00
commit 367a9501d3
65 changed files with 1428 additions and 123 deletions

View file

@ -1,10 +1,2 @@
setopt correct_all # correct commands, but not any arguments (correct_all would do that)
setopt correct
alias man='nocorrect man'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder'

View file

@ -9,16 +9,19 @@ 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=''
local GIT_STATUS=''
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty" SUBMODULE_SYNTAX="--ignore-submodules=dirty"
fi fi
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN" echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi fi
fi fi
} }
# get the difference between the local and remote branches # get the difference between the local and remote branches
@ -62,7 +65,7 @@ function git_prompt_long_sha() {
git_prompt_status() { git_prompt_status() {
INDEX=$(git status --porcelain -b 2> /dev/null) INDEX=$(git status --porcelain -b 2> /dev/null)
STATUS="" STATUS=""
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
@ -112,7 +115,7 @@ function git_compare_version() {
local INPUT_GIT_VERSION=$1; local INPUT_GIT_VERSION=$1;
local INSTALLED_GIT_VERSION local INSTALLED_GIT_VERSION
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION}); INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
INSTALLED_GIT_VERSION=($(git --version)); INSTALLED_GIT_VERSION=($(git --version 2>/dev/null));
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
for i in {1..3}; do for i in {1..3}; do

View file

@ -1,5 +1,7 @@
## Command history configuration ## Command history configuration
HISTFILE=$HOME/.zsh_history if [ -z $HISTFILE ]; then
HISTFILE=$HOME/.zsh_history
fi
HISTSIZE=10000 HISTSIZE=10000
SAVEHIST=10000 SAVEHIST=10000

View file

@ -7,7 +7,13 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
if [ "$DISABLE_LS_COLORS" != "true" ] if [ "$DISABLE_LS_COLORS" != "true" ]
then then
# Find the option for using colors in ls, depending on the version: Linux or BSD # Find the option for using colors in ls, depending on the version: Linux or BSD
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' if [[ "$(uname -s)" == "NetBSD" ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
else
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi
fi fi
#setopt no_beep #setopt no_beep

View file

@ -1,7 +1,7 @@
# Check for updates on initial load... # Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ] if [ "$DISABLE_AUTO_UPDATE" != "true" ]
then then
/usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
fi fi
# Initializes Oh My Zsh # Initializes Oh My Zsh

View file

@ -1,17 +1,7 @@
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%Y)
fi
_ant_does_target_list_need_generating () { _ant_does_target_list_need_generating () {
if [ ! -f .ant_targets ]; then return 0; [ ! -f .ant_targets ] && return 0;
else [ .ant_targets -nt build.xml ] && return 0;
accurate=$($stat_cmd .ant_targets) return 1;
changed=$($stat_cmd build.xml)
return $(expr $accurate '>=' $changed)
fi
} }
_ant () { _ant () {

58
plugins/bower/_bower Executable file
View file

@ -0,0 +1,58 @@
# Credits to npm's awesome completion utility.
#
# Bower completion script, based on npm completion script.
###-begin-bower-completion-###
#
# Installation: bower completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower
#
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
export COMP_WORDBREAKS
if type complete &>/dev/null; then
_bower_completion () {
local si="$IFS"
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
bower completion -- "${COMP_WORDS[@]}" \
2>/dev/null)) || return $?
IFS="$si"
}
complete -F _bower_completion bower
elif type compdef &>/dev/null; then
_bower_completion() {
si=$IFS
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
COMP_LINE=$BUFFER \
COMP_POINT=0 \
bower completion -- "${words[@]}" \
2>/dev/null)
IFS=$si
}
compdef _bower_completion bower
elif type compctl &>/dev/null; then
_bower_completion () {
local cword line point words si
read -Ac words
read -cn cword
let cword-=1
read -l line
read -ln point
si="$IFS"
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
COMP_LINE="$line" \
COMP_POINT="$point" \
bower completion -- "${words[@]}" \
2>/dev/null)) || return $?
IFS="$si"
}
compctl -K _bower_completion bower
fi
###-end-bower-completion-###

View file

@ -0,0 +1,38 @@
alias bi="bower install"
alias bl="bower list"
alias bs="bower search"
bower_package_list=''
_bower ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
_describe -t commands 'bower' subcommands
;;
(options)
case $line[1] in
(install)
if [ -z "$bower_package_list" ];then
bower_package_list=$(bower search | awk 'NR > 2' | cut -d '-' -f 2 | cut -d ' ' -f 2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
fi
compadd "$@" $(echo $bower_package_list)
;;
esac
;;
esac
}
compdef _bower bower

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 zeus) bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
## Functions ## Functions

View file

@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () {
return 1; return 1;
fi fi
if [ ! -f ${_cake_task_cache_file} ]; then return 0; [ ! -f ${_cake_task_cache_file} ] && return 0;
else [ ${_cake_task_cache_file} -nt Cakefile ] && return 0;
accurate=$(stat -f%m $_cake_task_cache_file) return 1;
changed=$(stat -f%m Cakefile)
return $(expr $accurate '>=' $changed)
fi
} }
_cake () { _cake () {
@ -33,4 +30,4 @@ _cake () {
fi fi
} }
compdef _cake cake compdef _cake cake

View file

@ -1,7 +1,7 @@
#compdef cap #compdef cap
#autoload #autoload
if [ -f config/deploy.rb ]; then if [[ -f config/deploy.rb || -f Capfile ]]; then
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~

View file

@ -0,0 +1,11 @@
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}

View file

@ -13,6 +13,8 @@ _composer_get_command_list () {
_composer () { _composer () {
if [ -f composer.json ]; then if [ -f composer.json ]; then
compadd `_composer_get_command_list` compadd `_composer_get_command_list`
else
compadd create-project init search selfupdate show
fi fi
} }
@ -26,4 +28,4 @@ alias ci='composer install'
alias ccp='composer create-project' alias ccp='composer create-project'
# install composer in the current directory # install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php' alias cget='curl -s https://getcomposer.org/installer | php'

View file

@ -0,0 +1,3 @@
function copydir {
pwd | tr -d "\r\n" | pbcopy
}

View file

@ -0,0 +1,29 @@
# ------------------------------------------------------------------------------
# FILE: emoji-clock.plugin.zsh
# DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
# Inspired by Andre Torrez' "Put A Burger In Your Shell"
# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# -----------------------------------------------------------------------------
function emoji-clock() {
hour=$(date '+%I')
minutes=$(date '+%M')
case $hour in
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
*) clock="⌛";;
esac
echo $clock
}

View file

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

View file

@ -53,7 +53,7 @@ function extract() {
(*.lzma) unlzma "$1" ;; (*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;; (*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;; (*.zip) unzip "$1" -d $extract_dir ;;
(*.rar) unrar e -ad "$1" ;; (*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;; (*.7z) 7za x "$1" ;;
(*.deb) (*.deb)
mkdir -p "$extract_dir/control" mkdir -p "$extract_dir/control"

60
plugins/fabric/_fab Normal file
View file

@ -0,0 +1,60 @@
#compdef fab
#autoload
local curcontext=$curcontext state line
declare -A opt_args
declare target_list
target_list=(`fab --shortlist 2>/dev/null`)
_targets() {
_describe -t commands "fabric targets" target_list
}
output_levels=(
'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.'
'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur there just wont be any output about why Fabric aborted!'
'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.'
'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.'
'stdout: Local, or remote, stdout, i.e. non-error output from commands.'
'stderr: Local, or remote, stderr, i.e. error-related output from commands.'
'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.'
)
_arguments -w -S -C \
'(-)'{-h,--help}'[show this help message and exit]: :->noargs' \
'(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \
'(-)--list[print list of possible commands and exit]: :->noargs' \
'(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
'(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
'(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
"(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
'(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
'(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
'(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
'(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \
'(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \
'(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \
'(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \
'(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \
'(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \
'-i+[path to SSH private key file. May be repeated]: :_files' \
"(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \
'(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \
'(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \
'(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \
'(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \
'*::: :->subcmds' && return 0
if [[ CURRENT -ge 1 ]]; then
case $state in
noargs)
_message "nothing to complete";;
levels)
_describe -t commands "output levels" output_levels;;
*)
_targets;;
esac
return
fi

View file

@ -0,0 +1 @@
# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete.

View file

@ -0,0 +1,6 @@
# start fbterm automatically in /dev/tty*
if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then
fbterm
exit
fi

View file

@ -14,8 +14,12 @@ gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff compdef _git gdv=git-diff
alias gc='git commit -v' alias gc='git commit -v'
compdef _git gc=git-commit compdef _git gc=git-commit
alias gc!='git commit -v --amend'
compdef _git gc!=git-commit
alias gca='git commit -v -a' alias gca='git commit -v -a'
compdef _git gca=git-commit compdef _git gc=git-commit
alias gca!='git commit -v -a --amend'
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'

View file

@ -275,7 +275,7 @@ __git_ps1 ()
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
if [ -n "$(git ls-files --others --exclude-standard)" ]; then if [ -n "$(git ls-files --others --exclude-standard)" ]; then
u="%" u="%%"
fi fi
fi fi

View file

@ -1,5 +1,22 @@
# Setup hub function for git, if it is available; http://github.com/defunkt/hub # Setup hub function for git, if it is available; http://github.com/defunkt/hub
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
# Autoload _git completion functions
if declare -f _git > /dev/null; then
_git
fi
if declare -f _git_commands > /dev/null; then
_hub_commands=(
'alias:show shell instructions for wrapping git'
'pull-request:open a pull request on GitHub'
'fork:fork origin repo on GitHub'
'create:create new repo on GitHub for the current project'
'browse:browse the project on GitHub'
'compare:open GitHub compare view'
)
# Extend the '_git_commands' function with hub commands
eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')"
fi
# eval `hub alias -s zsh` # eval `hub alias -s zsh`
function git(){ function git(){
if ! (( $+_has_working_hub )); then if ! (( $+_has_working_hub )); then

View file

@ -0,0 +1,150 @@
# From : http://golang.org/misc/zsh/go?m=text
# gc
prefixes=(5 6 8)
for p in $prefixes; do
compctl -g "*.${p}" ${p}l
compctl -g "*.go" ${p}g
done
# standard go tools
compctl -g "*.go" gofmt
# gccgo
compctl -g "*.go" gccgo
# go tool
__go_tool_complete() {
typeset -a commands build_flags
commands+=(
'build[compile packages and dependencies]'
'clean[remove object files]'
'doc[run godoc on package sources]'
'fix[run go tool fix on packages]'
'fmt[run gofmt on package sources]'
'get[download and install packages and dependencies]'
'help[display help]'
'install[compile and install packages and dependencies]'
'list[list packages]'
'run[compile and run Go program]'
'test[test packages]'
'tool[run specified go tool]'
'version[print Go version]'
'vet[run go tool vet on packages]'
)
if (( CURRENT == 2 )); then
# explain go commands
_values 'go tool commands' ${commands[@]}
return
fi
build_flags=(
'-a[force reinstallation of packages that are already up-to-date]'
'-n[print the commands but do not run them]'
"-p[number of parallel builds]:number"
'-x[print the commands]'
"-work[print temporary directory name and keep it]"
"-gcflags[flags for 5g/6g/8g]:flags"
"-ldflags[flags for 5l/6l/8l]:flags"
"-gccgoflags[flags for gccgo]:flags"
)
__go_list() {
local expl importpaths
declare -a importpaths
importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
_wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
}
case ${words[2]} in
clean|doc)
_arguments -s -w : '*:importpaths:__go_list'
;;
fix|fmt|list|vet)
_alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
;;
install)
_arguments -s -w : ${build_flags[@]} \
"-v[show package names]" \
'*:importpaths:__go_list'
;;
get)
_arguments -s -w : \
${build_flags[@]}
;;
build)
_arguments -s -w : \
${build_flags[@]} \
"-v[show package names]" \
"-o[output file]:file:_files" \
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
;;
test)
_arguments -s -w : \
${build_flags[@]} \
"-c[do not run, compile the test binary]" \
"-i[do not run, install dependencies]" \
"-v[print test output]" \
"-x[print the commands]" \
"-short[use short mode]" \
"-parallel[number of parallel tests]:number" \
"-cpu[values of GOMAXPROCS to use]:number list" \
"-run[run tests and examples matching regexp]:regexp" \
"-bench[run benchmarks matching regexp]:regexp" \
"-benchtime[run each benchmark during n seconds]:duration" \
"-timeout[kill test after that duration]:duration" \
"-cpuprofile[write CPU profile to file]:file:_files" \
"-memprofile[write heap profile to file]:file:_files" \
"-memprofilerate[set heap profiling rate]:number" \
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
;;
help)
_values "${commands[@]}" \
'gopath[GOPATH environment variable]' \
'importpath[description of import paths]' \
'remote[remote import path syntax]' \
'testflag[description of testing flags]' \
'testfunc[description of testing functions]'
;;
run)
_arguments -s -w : \
${build_flags[@]} \
'*:file:_path_files -g "*.go"'
;;
tool)
if (( CURRENT == 3 )); then
_values "go tool" $(go tool)
return
fi
case ${words[3]} in
[568]g)
_arguments -s -w : \
'-I[search for packages in DIR]:includes:_path_files -/' \
'-L[show full path in file:line prints]' \
'-S[print the assembly language]' \
'-V[print the compiler version]' \
'-e[no limit on number of errors printed]' \
'-h[panic on an error]' \
'-l[disable inlining]' \
'-m[print optimization decisions]' \
'-o[file specify output file]:file' \
'-p[assumed import path for this code]:importpath' \
'-u[disable package unsafe]' \
"*:file:_files -g '*.go'"
;;
[568]l)
local O=${words[3]%l}
_arguments -s -w : \
'-o[file specify output file]:file' \
'-L[search for packages in DIR]:includes:_path_files -/' \
"*:file:_files -g '*.[ao$O]'"
;;
dist)
_values "dist tool" banner bootstrap clean env install version
;;
*)
# use files by default
_files
;;
esac
;;
esac
}
compdef __go_tool_complete go

View file

@ -54,27 +54,14 @@ function in_gradle() {
fi fi
} }
############################################################################
# Define the stat_cmd command based on platform behavior
##########################################################################
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%Y)
fi
############################################################################## Examine the build.gradle file to see if its ############################################################################## Examine the build.gradle file to see if its
# timestamp has changed, and if so, regen # timestamp has changed, and if so, regen
# the .gradle_tasks cache file # the .gradle_tasks cache file
############################################################################ ############################################################################
_gradle_does_task_list_need_generating () { _gradle_does_task_list_need_generating () {
if [ ! -f .gradletasknamecache ]; then return 0; [ ! -f .gradletasknamecache ] && return 0;
else [ .gradletasknamecache -nt build.gradle ] && return 0;
accurate=$($stat_cmd .gradletasknamecache) return 1;
changed=$($stat_cmd build.gradle)
return $(expr $accurate '>=' $changed)
fi
} }

View file

@ -24,17 +24,23 @@ _enumerateGrailsScripts() {
return return
fi fi
# - Strip the path scripts=()
# - Remove all scripts with a leading '_' for file in $files
# - PackagePlugin_.groovy -> PackagePlugin do
# - PackagePlugin -> Package-Plugin # - Strip the path
# - Package-Plugin -> package-plugin # - Remove all scripts with a leading '_'
basename $files \ # - PackagePlugin_.groovy -> PackagePlugin
| sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\ # - PackagePlugin -> Package-Plugin
-e 's/([a-z])([A-Z])/\1-\2/g' \ # - Package-Plugin -> package-plugin
| tr "[:upper:]" "[:lower:]" \ command=$(basename $file \
| sort \ | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\
| uniq -e 's/([a-z])([A-Z])/\1-\2/g' \
| tr "[:upper:]" "[:lower:]" \
| sort \
| uniq)
scripts+=($command)
done
echo $scripts
} }
_grails() { _grails() {

View file

@ -1,5 +1,10 @@
#compdef knife #compdef knife
# You can override the path to knife.rb and your cookbooks by setting
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
# Read around where these are used for more detail.
# These flags should be available everywhere according to man knife # These flags should be available everywhere according to man knife
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
@ -170,11 +175,13 @@ _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() {
local knife_rb="$HOME/.chef/knife.rb"
if [ -f ./.chef/knife.rb ]; then local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
knife_rb="./.chef/knife.rb" if [ -f ./.chef/knife.rb ]; then
fi knife_rb="./.chef/knife.rb"
(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) fi
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
(for i in $cookbook_path; 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

@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir"
# Updates the last directory once directory is changed. # Updates the last directory once directory is changed.
function chpwd() { function chpwd() {
echo "$PWD" > "$cache_file" # Use >| in case noclobber is set to avoid "file exists" error
pwd >| "$cache_file"
} }
# Changes directory to the last working directory. # Changes directory to the last working directory.

View file

@ -7,7 +7,10 @@ alias hgco='hg checkout'
alias hgd='hg diff' alias hgd='hg diff'
alias hged='hg diffmerge' alias hged='hg diffmerge'
# pull and update # pull and update
alias hgi='hg incoming'
alias hgl='hg pull -u' alias hgl='hg pull -u'
alias hglr='hg pull --rebase'
alias hgo='hg outgoing'
alias hgp='hg push' alias hgp='hg push'
alias hgs='hg status' alias hgs='hg status'
# this is the 'git commit --amend' equivalent # this is the 'git commit --amend' equivalent
@ -17,4 +20,4 @@ function hg_current_branch() {
if [ -d .hg ]; then if [ -d .hg ]; then
echo hg:$(hg branch) echo hg:$(hg branch)
fi fi
} }

View file

@ -163,7 +163,7 @@ function listMavenCompletions {
cli:execute cli:execute-phase cli:execute cli:execute-phase
archetype:generate generate-sources archetype:generate generate-sources
cobertura:cobertura cobertura:cobertura
-Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi` -Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
); );
} }

View file

@ -154,3 +154,6 @@ function trash() {
IFS=$temp_ifs IFS=$temp_ifs
} }
function vncviewer() {
open vnc://$@
}

View file

@ -1,16 +1,13 @@
_phing_does_target_list_need_generating () { _phing_does_target_list_need_generating () {
if [ ! -f .phing_targets ]; then return 0; [ ! -f .phing_targets ] && return 0;
else [ .phing_targets -nt build.xml ] && return 0;
accurate=$(stat -f%m .phing_targets) return 1;
changed=$(stat -f%m build.xml)
return $(expr $accurate '>=' $changed)
fi
} }
_phing () { _phing () {
if [ -f build.xml ]; then if [ -f build.xml ]; then
if _phing_does_target_list_need_generating; then if _phing_does_target_list_need_generating; then
phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets
fi fi
compadd `cat .phing_targets` compadd `cat .phing_targets`
fi fi

42
plugins/pj/pj.plugin.zsh Normal file
View file

@ -0,0 +1,42 @@
#!/bin/zsh
#
# Original idea by DefV (Jan De Poorter)
# Source: https://gist.github.com/pjaspers/368394#comment-1016
#
# Usage:
# - Set `$PROJECT_PATHS` in your ~/.zshrc
# e.g.: PROJECT_PATHS=(~/src ~/work)
# - In ZSH you now can open a project directory with the command: `pj my-project`
# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS
# Also tab completion is supported.
# - `pjo my-project` will open the directory in $EDITOR
#
function pj() {
cmd="cd"
file=$1
if [[ "open" == "$file" ]] then
file=$2
cmd=(${(s: :)EDITOR})
fi
for project in $PROJECT_PATHS; do
if [[ -d $project/$file ]] then
$cmd "$project/$file"
unset project # Unset project var
return
fi
done
echo "No such project $1"
}
alias pjo="pj open"
function _pj () {
compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'`
}
compdef _pj pj

55
plugins/powify/_powify Normal file
View file

@ -0,0 +1,55 @@
#compdef powify
_powify_all_servers() {
all_servers=(`ls $HOME/.pow/`)
}
local -a all_servers
local -a _1st_arguments
_1st_arguments=(
'server:server specific commands'
'utils:manage powify'
'create:creates a pow app from the current directory (to change the name append name as an argument)'
'destroy:destroys the pow app linked to the current directory'
'restart:restarts the pow app linked to the current directory'
'always_restart:reload the pow app after each request'
'always_restart_off:do not reload the pow app after each request'
'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]'
'environment:run the this pow app in a different environment (aliased `env`)'
'browse:opens and navigates the default browser to this app'
'logs:tail the application logs'
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "powify command" _1st_arguments
return
fi
case "$words[1]" in
server)
_values \
'install[install pow server]' \
'reinstall[reinstall pow server]' \
'update[update pow server]' \
'uninstall[uninstall pow server]' \
'list[list all pow apps]' \
'start[start the pow server]' \
'stop[stop the pow server]' \
'restart[restart the pow server]' \
'host[adds all pow apps to /etc/hosts file]' \
'unhost[removes all pow apps from /etc/hosts file]' \
'status[print the current server status]' \
'config[print the current server configuration]' \
'logs[tails the pow server logs]' ;;
utils)
_values \
'install[install powify.dev server management tool]' \
'reinstall[reinstall powify.dev server management tool]' \
'uninstall[uninstall powify.dev server management tool]' ;;
destroy|restart|always_restart|always_restart_off|rename|browse|logs)
_powify_all_servers
_wanted all_servers expl 'all pow servers' compadd -a all_servers ;;
esac

View file

@ -0,0 +1,12 @@
# You will probably want to list this plugin as the first in your .zshrc.
# This will look for a custom profile for the local machine and each domain or
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
parts=(${(s:.:)$(hostname)})
for i in {${#parts}..1}; do
profile=${(j:.:)${parts[$i,${#parts}]}}
file=$ZSH_CUSTOM/profiles/$profile
if [ -f $file ]; then
source $file
fi
done

View file

@ -17,7 +17,7 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
FOUND_RBENV=1 FOUND_RBENV=1
export RBENV_ROOT=$rbenvdir export RBENV_ROOT=$rbenvdir
export PATH=${rbenvdir}/bin:$PATH export PATH=${rbenvdir}/bin:$PATH
eval "$(rbenv init - zsh)" eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions" alias rubies="rbenv versions"
alias gemsets="rbenv gemset list" alias gemsets="rbenv gemset list"
@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
function gems { function gems {
local rbenv_path=$(rbenv prefix) local rbenv_path=$(rbenv prefix)
gem list $@ | sed \ gem list $@ | sed -E \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
} }
function rbenv_prompt_info() { function rbenv_prompt_info() {

79
plugins/rebar/_rebar Normal file
View file

@ -0,0 +1,79 @@
#compdef rebar
local curcontext=$curcontext state ret=1
typeset -ga _rebar_global_opts
_rebar_global_opts=(
'(--help -h)'{--help,-h}'[Show the program options]'
'(--commands -c)'{--commands,-c}'[Show available commands]'
'(--version -V)'{--version,-V}'[Show version information]'
'(-vvv -vv -v)'--verbose+'[Verbosity level. Default: 0]:verbosity level:(0 1 2 3)'
'(-vvv)-v[Slightly more verbose output]'
'(-vvv)-vv[More verbose output]'
'(-v -vv)-vvv[Most verbose output]'
'(--force -f)'{--force,-f}'[Force]'
'-D+[Define compiler macro]'
'(--jobs -j)'{--jobs+,-j+}'[Number of concurrent workers a command may use. Default: 3]:workers:(1 2 3 4 5 6 7 8 9)'
'(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files'
'(--profile -p)'{--profile,-p}'[Profile this run of rebar]'
'(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]'
)
_rebar () {
_arguments -C $_rebar_global_opts \
'*::command and variable:->cmd_and_var' \
&& return
case $state in
cmd_and_var)
_values -S = 'variables' \
'clean[Clean]' \
'compile[Compile sources]' \
'create[Create skel based on template and vars]' \
'create-app[Create simple app skel]' \
'create-node[Create simple node skel]' \
'list-template[List avaiavle templates]' \
'doc[Generate Erlang program documentation]' \
'check-deps[Display to be fetched dependencies]' \
'get-deps[Fetch dependencies]' \
'update-deps[Update fetched dependencies]' \
'delete-deps[Delete fetched dependencies]' \
'list-deps[List dependencies]' \
'generate[Build release with reltool]' \
'overlay[Run reltool overlays only]' \
'generate-appups[Generate appup files]' \
'generate-upgrade[Build an upgrade package]' \
'eunit[Run eunit tests]' \
'ct[Run common_test suites]' \
'qc[Test QuickCheck properties]' \
'xref[Run cross reference analysis]' \
'help[Show the program options]' \
'version[Show version information]' \
'apps[Application names to process]:' \
'case[Common Test case]:' \
'dump_spec[Dump reltool spec]:' \
'jobs[Number of workers]::workers:(0 1 2 3 4 5 6 7 8 9)' \
'suites[Common Test suites]::suite name:_path_files -W "(src test)" -g "*.erl(:r)"' \
'verbose[Verbosity level]::verbosity level:(0 1 2 3)' \
'appid[Application id]:' \
'previous_release[Previous release path]:' \
'nodeid[Node id]:' \
'root_dir[Reltool config root directory]::directory:_files -/' \
'skip_deps[Skip deps]::flag:(true false)' \
'skip_apps[Application names to not process]::flag:(true false)' \
'template[Template name]:' \
'template_dir[Template directory]::directory:_files -/' \
&& ret=0
;;
esac
}
_rebar
# Local variables:
# mode: shell-script
# sh-basic-offset: 2
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: sw=2 ts=2 et filetype=sh

View file

@ -4,7 +4,8 @@ alias rubies='rvm list rubies'
alias gemsets='rvm gemset list' alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7-p334' local ruby18='ruby-1.8.7-p334'
local ruby19='ruby-1.9.3-p194' local ruby19='ruby-1.9.3-p385'
local ruby20='ruby-2.0.0-rc2'
function rb18 { function rb18 {
if [ -z "$1" ]; then if [ -z "$1" ]; then
@ -28,6 +29,17 @@ function rb19 {
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`}
compdef _rb19 rb19 compdef _rb19 rb19
function rb20 {
if [ -z "$1" ]; then
rvm use "$ruby"
else
rvm use "$ruby20@$1"
fi
}
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
compdef _rb20 rb20
function rvm-update { function rvm-update {
rvm get head rvm get head
rvm reload # TODO: Reload rvm completion? rvm reload # TODO: Reload rvm completion?

View file

@ -0,0 +1,54 @@
# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
#
# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html
# create a new keymap to use while pasting
bindkey -N paste
# make everything in this keymap call our custom widget
bindkey -R -M paste "^@"-"\M-^?" paste-insert
# these are the codes sent around the pasted text in bracketed
# paste mode.
# do the first one with both -M viins and -M vicmd in vi mode
bindkey '^[[200~' _start_paste
bindkey -M paste '^[[201~' _end_paste
# insert newlines rather than carriage returns when pasting newlines
bindkey -M paste -s '^M' '^J'
zle -N _start_paste
zle -N _end_paste
zle -N zle-line-init _zle_line_init
zle -N zle-line-finish _zle_line_finish
zle -N paste-insert _paste_insert
# switch the active keymap to paste mode
function _start_paste() {
bindkey -A paste main
}
# go back to our normal keymap, and insert all the pasted text in the
# command line. this has the nice effect of making the whole paste be
# a single undo/redo event.
function _end_paste() {
#use bindkey -v here with vi mode probably. maybe you want to track
#if you were in ins or cmd mode and restore the right one.
bindkey -e
LBUFFER+=$_paste_content
unset _paste_content
}
function _paste_insert() {
_paste_content+=$KEYS
}
function _zle_line_init() {
# Tell terminal to send escape codes around pastes.
[[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h'
}
function _zle_line_finish() {
# Tell it to stop when we leave zle, so pasting in other programs
# doesn't get the ^[[200~ codes around the pasted text.
[[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l'
}

55
plugins/sbt/_sbt Normal file
View file

@ -0,0 +1,55 @@
#compdef sbt
#autoload
local -a _sbt_commands
_sbt_commands=(
'clean:delete files produced by the build'
'compile:compile sources'
'console:start the Scala REPL with project classes on the classpath'
'console-quick:start the Scala REPL with project deps on the classpath'
'console-project:start the Scala REPL w/sbt+build-def on the classpath'
'dist:generate distribution artifacts'
'dist\:clean:clean distribution artifacts'
'doc:generate API documentation'
'gen-idea:generate Intellij Idea project files'
'package:produce the main artifact, such as a binary jar'
'package-doc:produce a doc artifact, such as a jar containing API docs'
'package-src:produce a source artifact, such as a jar containing sources'
'publish:publish artifacts to a repository'
'publish-local:publish artifacts to the local repository'
'run:run a main class'
'run-main:run the main class selected by the first argument'
'test:execute all tests'
'test-only:execute the tests provided as arguments'
'test-quick:execute previously failed tests'
'update:resolve and optionally retrieve dependencies'
)
local expl
_arguments \
'(-help)-h[prints an help message]' \
'(-h)-help[prints an help message]' \
'(-verbose)-v[this runner is chattier]' \
'(-v)-verbose[this runner is chattier]' \
'(-debug)-d[set sbt log level to debug]' \
'(-d)-debug[set sbt log level to debug]' \
'-no-colors[disable ANSI color codes]' \
'-sbt-create[start even if current dir contains no sbt project]' \
'-sbt-dir[path to global settings/plugins dir (default: ~/.sbt)]' \
'-sbt-boot[path to shared boot dir (default: ~/.sbt/boot)]' \
'-ivy[path to local Ivy repository (default: ~/.ivy2)]' \
'-mem[set memory options]' \
'-no-share[use all local caches; no sharing]' \
'-no-global[use global caches, but do not use global ~/.sbt dir]' \
'-jvm-debug[turn on JVM debugging, open at the given port]' \
'-batch[disable interactive mode]' \
'-sbt-version[use the specified version of sbt]' \
'-sbt-jar[use the specified jar as the sbt launcher]' \
'(-sbt-snapshot)-sbt-rc[use an RC version of sbt]' \
'(-sbt-rc)-sbt-snapshot[use a snapshot version of sbt]' \
'-java-home[alternate JAVA_HOME]' \
'*:: :->subcmds' && return 0
_describe -t commands "sbt subcommand" _sbt_commands
return

View file

@ -0,0 +1,23 @@
# ------------------------------------------------------------------------------
# FILE: sbt.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
# VERSION: 1.0.2
# ------------------------------------------------------------------------------
# aliases - mnemonic: prefix is 'sb'
alias sbc='sbt compile'
alias sbco='sbt console'
alias sbcq='sbt console-quick'
alias sbcl='sbt clean'
alias sbcp='sbt console-project'
alias sbd='sbt doc'
alias sbdc='sbt dist:clean'
alias sbdi='sbt dist'
alias sbgi='sbt gen-idea'
alias sbp='sbt publish'
alias sbpl='sbt publish-local'
alias sbr='sbt run'
alias sbrm='sbt run-main'
alias sbu='sbt update'
alias sbx='sbt test'

249
plugins/scala/_scala Normal file
View file

@ -0,0 +1,249 @@
#compdef scala scalac
# ------------------------------------------------------------------------------
# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for scala and scalac (http://www.scala-lang.org/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Tony Sloane <inkytonik@gmail.com>
#
# ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
_scala_features () {
compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \
"existentials" "experimental.macros" "_"
}
_scala_phases () {
compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \
"extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \
"tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \
"lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \
"inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal"
}
local -a shared_opts
shared_opts=(
"-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
"-classpath+[Specify where to find user class files]:directory:_files -/"
"-D-[Pass -Dproperty=value directly to the runtime system]"
"-d+[Destination for generated classfiles]: directory or jar file:_files"
"-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files"
"-deprecation[Emit warning and location for usages of deprecated APIs]"
"-encoding+[Specify character encoding used by source files]:encoding:"
"-explaintypes[Explain type errors in more detail]"
"-extdirs+[Override location of installed extensions]:extensions directory:_files -/"
"-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)"
"-help[Print a synopsis of standard options]"
"-J-[pass argument directly to Java runtime system]:JVM argument:"
"-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/"
"-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/"
"-language\:-[Enable one or more language features]:feature:_scala_features"
"-no-specialization[Ignore @specialize annotations]"
"-nobootcp[Do not use the boot classpath for the scala jars]"
"-nowarn[Generate no warnings]"
"-optimise[Generate faster bytecode by applying optimisations to the program]"
"-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:"
"-print[Print program with Scala-specific features removed]"
"-sourcepath+[Specify location(s) of source files]:source file directory:_files -/"
"-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)"
"-toolcp+[Add to the runner classpath]:directory:_files -/"
"-unchecked[Enable detailed unchecked (erasure) warnings]"
"-uniqid[Uniquely tag all identifiers in debugging output]"
"-usejavacp[Utilize the java.class.path in classpath resolution]"
"-verbose[Output messages about what the compiler is doing]"
"-version[Print product version and exit]"
"-X[Print a synopsis of advanced options]"
"-Y[Print a synopsis of private options]"
)
local -a X_opts
X_opts=(
"-Xcheck-null[Warn upon selection of nullable reference]"
"-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
"-Xdisable-assertions[Generate no assertions or assumptions]"
"-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]"
"-Xexperimental[Enable experimental extensions]"
"-Xfatal-warnings[Fail the compilation if there are any warnings]"
"-Xfull-lubs[Retains pre 2.10 behavior of less aggressive truncation of least upper bounds]"
"-Xfuture[Turn on future language features]"
"-Xgenerate-phase-graph+[Generate the phase graphs (outputs .dot files) to fileX.dot]:output file:_files"
"-Xlint[Enable recommended additional warnings]"
"-Xlog-free-terms[Print a message when reification creates a free term]"
"-Xlog-free-types[Print a message when reification resorts to generating a free type]"
"-Xlog-implicits[Show more detail on why some implicits are not applicable]"
"-Xlog-implicit-conversions[Print a message whenever an implicit conversion is inserted]"
"-Xlog-reflective-calls[Print a message when a reflective method call is generated]"
"-Xmacro-settings\:-[Custom settings for macros]:option"
"-Xmain-class+[Class for manifest's Main-Class entry (only useful with -d jar)]:path:"
"-Xmax-classfile-name+[Maximum filename length for generated classes]"
"-Xmigration[Warn about constructs whose behavior may have changed]"
"-Xno-forwarders[Do not generate static forwarders in mirror classes]"
"-Xno-patmat-analysis[Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation]"
"-Xno-uescape[Disable handling of \u unicode escapes]"
"-Xnojline[Do not use JLine for editing]"
"-Xoldpatmat[Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10]"
"-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases"
"-Xprint-icode\:-[Log internal icode to *.icode files after phase (default\: icode)]:phase name:_scala_phases"
"-Xprint-pos[Print tree positions, as offsets]"
"-Xprint-types[Print tree types (debugging option)]"
"-Xprompt[Display a prompt after each error (debugging option)]"
"-Xresident[Compiler stays resident: read source filenames from standard input]"
"-Xscript+[Treat the source file as a script and wrap it in a main method]:main object name"
"-Xshow-class+[Show internal representation of class]:class name"
"-Xshow-object+[Show internal representation of object]:object name"
"-Xshow-phases[Print a synopsis of compiler phases]"
"-Xsource-reader+[Specify a class name for a custom method of reading source files]:class name"
"-Xverify[Verify generic signatures in generated bytecode]"
"-Xassem-extdirs+[List of directories containing assemblies (requires -target:msil) (default\: lib)]:assembly directory:_files -/"
"-Xassem-name+[Name of the output assembly (requires -target:msil)]:assembly name:_files"
"-Xassem-path+[List of assemblies referenced by the program (requires -target:msil)]:assembly path:_files"
"-Xsourcedir+[Mirror source folder structure in output directory (requires -target:msil)]:source directory:_files -/"
"-Xplugin\:-[Load one or more plugins from file]:plugin file:_files"
"-Xpluginsdir+[Path to search compiler plugins]:plugin directory:_files -/"
"-Xplugin-list[Print a synopsis of loaded plugins]"
"-Xplugin-disable\:-[Disable the given plugin(s)]"
"-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
)
local -a Y_opts
Y_opts=(
"-Y[Print a synopsis of private options]"
"-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
"-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:build manager:(none refined simple)"
"-Yclosure-elim[Perform closure elimination]"
"-Ycompact-trees[Use compact tree printer when displaying trees]"
"-Ydead-code[Perform dead code elimination]"
"-Ydependent-method-types[Allow dependent method types]"
"-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/"
"-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]"
"-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/"
"-Yinfer-argument-types[Infer types for arguments of overriden methods]"
"-Yinline[Perform inlining when possible]"
"-Yinline-handlers[Perform exception handler inlining when possible]"
"-Yinline-warnings[Emit inlining warnings (normally surpressed due to high volume)]"
"-Yinvalidate+[Invalidate classpath entry before run]:classpath entry"
"-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)"
"-Ylog-classpath[Output information about what classpath is being applied]"
"-Yno-adapted-args[Do not adapt an argument list (either by inserting unit or creating a tuple) to match the receiver]"
"-Ymacro-debug-lite[Trace essential macro-related activities]"
"-Ymacro-debug-verbose[Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions]"
"-Yno-completion[Disable tab-completion in the REPL]"
"-Yno-generic-signatures[Suppress generation of generic signatures for Java]"
"-Yno-imports[Compile without any implicit imports]"
"-Yno-predef[Compile without importing Predef]"
"-Yno-self-type-checks[Suppress check for self-type conformance among inherited members]"
"-Yno-squeeze[Disable creation of compact code in matching]"
"-Ynotnull[Enable (experimental and incomplete) scala.NotNull]"
"-Yoverride-objects[Allow member objects to be overridden]"
"-Yoverride-vars[Allow vars to be overridden]"
"-Ypmat-naive[Desugar matches as naively as possible]"
"-Ypresentation-delay+[Wait number of ms after typing before starting typechecking]"
"-Ypresentation-log+[Log presentation compiler events into file]:log file:_files"
"-Ypresentation-replay+[Replay presentation compiler events from file]:log file:_files"
"-Ypresentation-strict[Do not report type errors in sources with syntax errors]"
"-Ypresentation-verbose[Print information about presentation compiler tasks]"
"-Yprofile-class+[Specify name of profiler class]:profiler class name"
"-Yprofile-memory[Heap snapshot after compiler run (requires jgpagent on JVM -agentpath)]"
"-Yrangepos[Use range positions for syntax trees]"
"-Yrecursion+[Set recursion depth used when locking symbols]"
"-Yreify-copypaste[Dump the reified trees in copypasteable representation]"
"-Yrepl-sync[Do not use asynchronous code for REPL startup]"
"-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)"
"-Yself-in-annots[Include a \"self\" identifier inside of annotations]"
"-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases"
"-Yshow-syms[Print the AST symbol hierarchy after each phase]"
"-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]"
"-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]"
"-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]"
"-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]"
"-Ystatistics[Print compiler statistics]"
"-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)"
"-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases"
"-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases"
"-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
"-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
"-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
"-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
"-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
"-Ywarn-adapted-args[Warn if an argument list is modified to match the receiver]"
"-Ywarn-all[Enable all -Y warnings]"
"-Ywarn-dead-code[Warn when dead code is identified]"
"-Ywarn-inaccessible[Warn about inaccessible types in method signatures]"
"-Ywarn-nullary-override[Warn when non-nullary overrides nullary, e.g. def foo() over def foo]"
"-Ywarn-nullary-unit[Warn when nullary methods return Unit]"
"-Ywarn-numeric-widen[Warn when numerics are widened]"
"-Ywarn-value-discard[Warn when non-Unit expression results are unused]"
"-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
"-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:manager:(none refined simple)"
"-Ycompletion-debug[Trace all tab completion activity]"
"-Ydebug[Increase the quantity of debugging output]"
"-Ydoc-debug[Trace all scaladoc activity]"
"-Yide-debug[Generate, validate and output trees using the interactive compiler]"
"-Yinfer-debug[Trace type inference and implicit search]"
"-Yissue-debug[Print stack traces when a context issues an error]"
"-Ypatmat-debug[Trace pattern matching translation]"
"-Ypmat-debug[Trace all pattern matcher activity]"
"-Ypos-debug[Trace position validation]"
"-Ypresentation-debug[Enable debugging output for the presentation compiler]"
"-Yreify-debug[Trace reification]"
"-Yrepl-debug[Trace all REPL activity]"
"-Ytyper-debug[Trace all type assignments]"
)
local -a scala_opts
scala_opts=(
"-e+[execute <string> as if entered in the repl]:string" \
"-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \
"-i+[preload <file> before starting the repl]:file to preload:_files" \
"-nc[no compilation daemon\: do not use the fsc offline compiler]" \
"-save[save the compiled script in a jar for future use]"
)
case $words[$CURRENT] in
-X*) _arguments $X_opts;;
-Y*) _arguments $Y_opts;;
*) case $service in
scala) _arguments $scala_opts $shared_opts "*::filename:_files";;
scalac) _arguments $shared_opts "*::filename:_files";;
esac
esac
return 0

View file

@ -6,11 +6,17 @@
# #
# zstyle :omz:plugins:ssh-agent agent-forwarding on # zstyle :omz:plugins:ssh-agent agent-forwarding on
# #
# To load multiple identies use the identities style, For # To load multiple identities use the identities style, For
# example: # example:
# #
# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github # zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
# #
# To set the maximum lifetime of the identities, use the
# lifetime style. The lifetime may be specified in seconds
# or as described in sshd_config(5) (see TIME FORMATS)
# If left unspecified, the default lifetime is forever.
#
# zstyle :omz:plugins:ssh-agent lifetime 4h
# #
# CREDITS # CREDITS
# #
@ -27,15 +33,18 @@ local _plugin__forwarding
function _plugin__start_agent() function _plugin__start_agent()
{ {
local -a identities local -a identities
local lifetime
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
# start ssh-agent and setup environment # start ssh-agent and setup environment
/usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} /usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
chmod 600 ${_plugin__ssh_env} chmod 600 ${_plugin__ssh_env}
. ${_plugin__ssh_env} > /dev/null . ${_plugin__ssh_env} > /dev/null
# load identies # load identies
zstyle -a :omz:plugins:ssh-agent identities identities zstyle -a :omz:plugins:ssh-agent identities identities
echo starting... echo starting ssh-agent...
/usr/bin/ssh-add $HOME/.ssh/${^identities} /usr/bin/ssh-add $HOME/.ssh/${^identities}
} }

View file

@ -1,7 +1,12 @@
# Sublime Text 2 Aliases # Sublime Text 2 Aliases
#unamestr = 'uname'
local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
)
if [[ $('uname') == 'Linux' ]]; then if [[ $('uname') == 'Linux' ]]; then
if [ -f '/usr/bin/sublime_text' ]; then if [ -f '/usr/bin/sublime_text' ]; then
@ -9,13 +14,15 @@ if [[ $('uname') == 'Linux' ]]; then
else else
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & } st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
fi fi
alias st=st_run alias st=st_run
elif [[ $('uname') == 'Darwin' ]]; then elif [[ $('uname') == 'Darwin' ]]; then
# Check if Sublime is installed in user's home application directory
if [[ -a $HOME/${_sublime_darwin_subl} ]]; then for _sublime_path in $_sublime_darwin_paths; do
alias st='$HOME/${_sublime_darwin_subl}' if [[ -a $_sublime_path ]]; then
else alias st="'$_sublime_path'"
alias st='${_sublime_darwin_subl}' fi
fi done
fi fi
alias stt='st .' alias stt='st .'

View file

@ -14,6 +14,8 @@ compdef _symfony2 app/console
compdef _symfony2 sf compdef _symfony2 sf
#Alias #Alias
alias sf2='php app/console' alias sf='php app/console'
alias sf2clear='php app/console cache:clear' alias sfcl='php app/console cache:clear'
alias sfroute='php app/console router:debug'
alias sfgb='php app/console generate:bundle'

View file

@ -0,0 +1,2 @@
set -g default-terminal $ZSH_TMUX_TERM
source $HOME/.tmux.conf

View file

@ -0,0 +1 @@
set -g default-terminal $ZSH_TMUX_TERM

View file

@ -0,0 +1,85 @@
# Only run if tmux is actually installed
if which tmux &> /dev/null
then
# Configuration variables
#
# Automatically start tmux
[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false
# Only autostart once. If set to false, tmux will attempt to
# autostart every time your zsh configs are reloaded.
[[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true
# Automatically connect to a previous session if it exists
[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true
# Automatically close the terminal when tmux exits
[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART
# Set term to screen or screen-256color based on current terminal support
[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true
# The TERM to use for non-256 color terminals.
# Tmux states this should be screen, but you may need to change it on
# systems without the proper terminfo
[[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen"
# The TERM to use for 256 color terminals.
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color"
# Get the absolute path to the current directory
local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)"
# Determine if the terminal supports 256 colors
if [[ `tput colors` == "256" ]]
then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
else
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
fi
# Set the correct local config file to use.
if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
then
#use this when they have a ~/.tmux.conf
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
else
#use this when they don't have a ~/.tmux.conf
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.only.conf"
fi
# Wrapper function for tmux.
function _zsh_tmux_plugin_run()
{
# We have other arguments, just run them
if [[ -n "$@" ]]
then
\tmux $@
# Try to connect to an existing session.
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
then
\tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
# Just run tmux, fixing the TERM variable if requested.
else
\tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
fi
}
# Use the completions for tmux for our function
compdef _tmux _zsh_tmux_plugin_run
# Alias tmux to our wrapper function.
alias tmux=_zsh_tmux_plugin_run
# Autostart if not already in tmux and enabled.
if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]]
then
# Actually don't autostart if we already did and multiple autostarts are disabled.
if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]
then
export ZSH_TMUX_AUTOSTARTED=true
_zsh_tmux_plugin_run
fi
fi
else
print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin."
fi

View file

@ -0,0 +1,36 @@
#compdef tmuxinator
#autoload
local curcontext="$curcontext" state line ret=1
local -a _configs
_arguments -C \
'1: :->cmds' \
'2:: :->args' && ret=0
case $state in
cmds)
_values "tmuxinator command" \
"start[start a tmux session using project's tmuxinator config]" \
"open[create a new project file and open it in your editor]" \
"copy[copy source_project project file to a new project called new_project]" \
"delete[deletes the project called project_name]" \
"implode[deletes all existing projects!]" \
"list[list all existing projects]" \
"doctor[look for problems in your configuration]" \
"help[shows this help document]" \
"version[shows tmuxinator version number]"
ret=0
;;
args)
case $line[1] in
start|open|copy|delete)
_configs=(`tmuxinator list | sed -n 's/^[ \t]\+//p'`)
_values 'configs' $_configs
ret=0
;;
esac
;;
esac
return ret

View file

@ -0,0 +1,17 @@
#
# Algorithm borrowed from http://wiki.rtorrent.org/MagnetUri and adapted to work with zsh.
#
function magnet_to_torrent() {
[[ "$1" =~ xt=urn:btih:([^\&/]+) ]] || return 1
hashh=${match[1]}
if [[ "$1" =~ dn=([^\&/]+) ]];then
filename=${match[1]}
else
filename=$hashh
fi
echo "d10:magnet-uri${#1}:${1}e" > "$filename.torrent"
}

View file

@ -8,18 +8,19 @@ _1st_arguments=(
'box:Box commands' 'box:Box commands'
'destroy:Destroys the vagrant environment' 'destroy:Destroys the vagrant environment'
'halt:Halts the currently running vagrant environment' 'halt:Halts the currently running vagrant environment'
'help:[TASK] Describe available tasks or one specific task'
'init:[box_name] [box_url] Initializes current folder for Vagrant usage' 'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
'package:Packages a vagrant environment for distribution' 'package:Packages a vagrant environment for distribution'
'plugin:Plugin commands'
'provision:Run the provisioner' 'provision:Run the provisioner'
'reload:Reload the vagrant environment' 'reload:Reload the vagrant environment'
'resume:Resumes a suspend vagrant environment' 'resume:Resumes a suspend vagrant environment'
'ssh:SSH into the currently running environment' 'ssh:SSH into the currently running environment'
'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
'status:Shows the status of the current Vagrant environment.' 'status:Shows the status of the current Vagrant environment.'
'suspend:Suspends the currently running vagrant environment' 'suspend:Suspends the currently running vagrant environment'
'up:Creates the vagrant environment' 'up:Creates the vagrant environment'
'version:Prints the Vagrant version information' '--help:[TASK] Describe available tasks or one specific task'
'--version:Prints the Vagrant version information'
) )
local -a _box_arguments local -a _box_arguments

View file

@ -16,8 +16,12 @@ function vundle () {
vim -c "execute \"BundleInstall\" | q | q" vim -c "execute \"BundleInstall\" | q | q"
} }
function vundle-update () { function vundle-update () {
vundle-init vundle-init
vim -c "execute \"BundleInstall!\" | q | q" vim -c "execute \"BundleInstall!\" | q | q"
} }
function vundle-clean () {
vundle-init
vim -c "execute \"BundleClean!\" | q | q"
}

View file

@ -25,6 +25,8 @@
* `zcu` aliases `zeus cucumber` * `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber` * `zucumber` aliases `zeus cucumber`
* `zspec` aliases `zeus rspec`
* `zt` aliases `zeus test` * `zt` aliases `zeus test`
* `zest` aliases `zeus test` * `zest` aliases `zeus test`

View file

@ -2,12 +2,6 @@
# Zeus preloads your Rails environment and forks that process whenever # Zeus preloads your Rails environment and forks that process whenever
# needed. This effectively speeds up Rails' boot process to under 1 sec. # needed. This effectively speeds up Rails' boot process to under 1 sec.
# Always use bundler.
# Rails depends on bundler, so we can be pretty sure, that there are no
# problems with this command. For all the other aliases I provided an
# alternative, in case people have conflicts with other plugins (e.g. suse).
alias zeus='bundle exec zeus'
# Init # Init
alias zi='zeus init' alias zi='zeus init'
alias zinit='zeus init' alias zinit='zeus init'
@ -40,6 +34,9 @@ alias zunner='zeus runner'
alias zcu='zeus cucumber' alias zcu='zeus cucumber'
alias zucumber='zeus cucumber' alias zucumber='zeus cucumber'
# Rspec
alias zspec='zeus rspec'
# Test # Test
alias zt='zeus test' alias zt='zeus test'
alias zest='zeus test' alias zest='zeus test'

View file

@ -83,6 +83,41 @@ prompt_git() {
fi fi
} }
prompt_hg() {
local rev status
if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
st='±'
elif [[ -n $(hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
st='±'
else
# if working copy is clean
prompt_segment green black
fi
echo -n $(hg prompt "⭠ {rev}@{branch}") $st
else
st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
branch=$(hg id -b 2>/dev/null)
if `hg st | grep -Eq "^\?"`; then
prompt_segment red black
st='±'
elif `hg st | grep -Eq "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
prompt_segment green black
fi
echo -n "⭠ $rev@$branch" $st
fi
fi
}
# Dir: current working directory # Dir: current working directory
prompt_dir() { prompt_dir() {
prompt_segment blue black '%~' prompt_segment blue black '%~'
@ -109,6 +144,7 @@ build_prompt() {
prompt_context prompt_context
prompt_dir prompt_dir
prompt_git prompt_git
prompt_hg
prompt_end prompt_end
} }

8
themes/crcandy.zsh-theme Normal file
View file

@ -0,0 +1,8 @@
PROMPT=$'
%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

View file

@ -14,7 +14,7 @@ fi
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
# Grab the current filepath, use shortcuts: ~/Desktop # Grab the current filepath, use shortcuts: ~/Desktop
# Append the current git branch, if in a git repository: ~aw@master # Append the current git branch, if in a git repository: ~aw@master
DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)"
# Grab the current username: dallas # Grab the current username: dallas
DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}"
# Use a % for normal users and a # for privelaged (root) users. # Use a % for normal users and a # for privelaged (root) users.

11
themes/gianu.zsh-theme Normal file
View file

@ -0,0 +1,11 @@
# Oh-my-Zsh prompt created by gianu
#
# github.com/gianu
# sgianazza@gmail.com
PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}]$ '
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg_bold[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}"

19
themes/itchy.zsh-theme Normal file
View file

@ -0,0 +1,19 @@
# Created by Daniel Bayerlein https://github.com/danielbayerlein
# Inspired by http://peepcode.com/blog/2012/my-command-line-prompt
local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
local user="%{$fg[cyan]%}%n%{$reset_color%}"
local host="%{$fg[cyan]%}@%m%{$reset_color%}"
local pwd="%{$fg[yellow]%}%~%{$reset_color%}"
PROMPT='${user}${host} ${pwd}
${smiley} '
RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}"

View file

@ -0,0 +1,23 @@
# ------------------------------------------------------------------------------
# FILE: jaischeema.zsh-theme
# DESCRIPTION: oh-my-zsh theme file.
# AUTHOR: Jais Cheema
# VERSION: 0.0.1
# ------------------------------------------------------------------------------
PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}%{$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]%}) "
if which rbenv &> /dev/null; then
RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}'
else
if which rvm-prompt &> /dev/null; then
RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}'
fi
fi

12
themes/kiwi.zsh-theme Normal file
View file

@ -0,0 +1,12 @@
#
# Kiwi ZSH Theme
#
PROMPT='%{$fg_bold[green]%}┌[%{$fg_bold[cyan]%}kiwish-4.2%{$fg_bold[green]%}]-(%{$fg_bold[white]%}%2~%{$fg_bold[green]%})-$(git_prompt_info)$(svn_prompt_info)$(battery_pct_prompt)
└> % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}git:%{$fg_bold[white]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[green]%}]-"
ZSH_THEME_SVN_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}svn:%{$fg_bold[white]%}/"
ZSH_THEME_SVN_PROMPT_SUFFIX="%{$fg_bold[green]%}]-"

View file

@ -0,0 +1,44 @@
# reference colors
GREEN="%{$fg_bold[green]%}"
RED="%{$fg_bold[red]%}"
CYAN="%{$fg_bold[cyan]%}"
YELLOW="%{$fg_bold[yellow]%}"
BLUE="%{$fg_bold[blue]%}"
MAGENTA="%{$fg_bold[magenta]%}"
WHITE="%{$fg_bold[white]%}"
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE)
# color reset
RESET_COLOR="%{$reset_color%}"
# which color should be applied?
USERNAME_NORMAL_COLOR=$WHITE
USERNAME_ROOT_COLOR=$RED
HOSTNAME_NORMAL_COLOR=$BLUE
# uncomment next line if you want auto-generated hostname color
#for i in `hostname`; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
HOSTNAME_ROOT_COLOR=$RED
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
CURRENT_DIR_COLOR=$CYAN
# zsh commands
USERNAME_COMMAND="%n"
HOSTNAME_COMMAND="%m"
CURRENT_DIR="%~"
# output: colors + commands
USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)"
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR"
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR"
LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*"
ZSH_THEME_GIT_PROMPT_CLEAN=")"
# wrap all together
PROMPT='$USERNAME_OUTPUT$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $LAST_COMMAND_OUTPUT%#$RESET_COLOR '
RPROMPT='%1(j.fg: [%j].) $GREEN$(git_prompt_info)$RESET_COLOR [%@]'

34
themes/ys.zsh-theme Normal file
View file

@ -0,0 +1,34 @@
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
#
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
# Mar 2013 ys
# Machine name.
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
# Directory info.
local current_dir='${PWD/#$HOME/~}'
# Git info.
local git_info='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}on%{$reset_color%} git:%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%{$fg[cyan]%}%n \
%{$fg[white]%}at \
%{$fg[green]%}$(box_name) \
%{$fg[white]%}in \
%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
${git_info} \
%{$fg[white]%}[%*]
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"

View file

@ -21,7 +21,7 @@ echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
echo "export PATH=$PATH" >> ~/.zshrc echo "export PATH=\$PATH:$PATH" >> ~/.zshrc
echo "\033[0;34mTime to change your default shell to zsh!\033[0m" echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
chsh -s `which zsh` chsh -s `which zsh`

View file

@ -1,6 +1,7 @@
current_path=`pwd` current_path=`pwd`
current_path=${current_path/ /\\ }
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
cd $ZSH cd "$ZSH"
if git pull origin master if git pull origin master
then then
@ -16,4 +17,4 @@ else
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
fi fi
cd "$current_path" cd "$current_path"