From 20b025ba2cd419a99630458052bfa9a9e8c99e91 Mon Sep 17 00:00:00 2001 From: Ian Yang Date: Fri, 2 Dec 2011 18:32:15 +0800 Subject: [PATCH 01/82] tmuxinator completion A utility to automate tmux session creation https://github.com/aziz/tmuxinator --- plugins/tmuxinator/_tmuxinator | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 plugins/tmuxinator/_tmuxinator diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator new file mode 100644 index 000000000..f0ff304dd --- /dev/null +++ b/plugins/tmuxinator/_tmuxinator @@ -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 \ No newline at end of file From 70e51186ec3f67b1126339c7570bd9f6549f0408 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 16 Dec 2011 14:01:59 +0100 Subject: [PATCH 02/82] Only `setopt correct`, not "correct_all". Using the correct_all option is too distracting, and needs a lot of `nocorrect` aliases to work around this. Using only "correct" to correct the command itself is more friendly. --- lib/correction.zsh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index fc60dcdbd..176ec16d5 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,10 +1,2 @@ -setopt correct_all - -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' +# correct commands, but not any arguments (correct_all would do that) +setopt correct From 8942d304ff55ad9467872ecab3f343552b5c2083 Mon Sep 17 00:00:00 2001 From: Daniel Bayerlein Date: Sat, 7 Apr 2012 18:23:12 +0200 Subject: [PATCH 03/82] Add Theme "itchy" --- themes/itchy.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/itchy.zsh-theme diff --git a/themes/itchy.zsh-theme b/themes/itchy.zsh-theme new file mode 100644 index 000000000..afc2abf69 --- /dev/null +++ b/themes/itchy.zsh-theme @@ -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%}" + From c23392ac5b9e8655a42e827983ba93636801136b Mon Sep 17 00:00:00 2001 From: jaischeema Date: Tue, 3 Jul 2012 13:02:29 +1000 Subject: [PATCH 04/82] Add new theme : jaischeema --- themes/jaischeema.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/jaischeema.zsh-theme diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme new file mode 100644 index 000000000..06778216d --- /dev/null +++ b/themes/jaischeema.zsh-theme @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# 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 From 8d60f9a0d8eaf7f72eb64f600fcecbe48a26300f Mon Sep 17 00:00:00 2001 From: jais Date: Tue, 3 Jul 2012 15:12:55 +1000 Subject: [PATCH 05/82] Fix the rvm gemset right prompt:wq --- themes/jaischeema.zsh-theme | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme index 06778216d..aecc5b961 100644 --- a/themes/jaischeema.zsh-theme +++ b/themes/jaischeema.zsh-theme @@ -17,6 +17,7 @@ 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%}' + if which rvm-prompt &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' + fi fi From 3ef82a908a10979d9a4d14e0674902c85b14a99e Mon Sep 17 00:00:00 2001 From: mikka Date: Sun, 2 Sep 2012 15:43:20 +0200 Subject: [PATCH 06/82] nginx and php-fpm plugins --- plugins/nginx/nginx.plugin.zsh | 195 +++++++++++++++++++++++++++++ plugins/nginx/templates/plain_php | 27 ++++ plugins/nginx/templates/symfony2 | 27 ++++ plugins/php-fpm/php-fpm.plugin.zsh | 75 +++++++++++ plugins/php-fpm/templates/pool | 11 ++ 5 files changed, 335 insertions(+) create mode 100644 plugins/nginx/nginx.plugin.zsh create mode 100644 plugins/nginx/templates/plain_php create mode 100644 plugins/nginx/templates/symfony2 create mode 100644 plugins/php-fpm/php-fpm.plugin.zsh create mode 100644 plugins/php-fpm/templates/pool diff --git a/plugins/nginx/nginx.plugin.zsh b/plugins/nginx/nginx.plugin.zsh new file mode 100644 index 000000000..6dd90c6d5 --- /dev/null +++ b/plugins/nginx/nginx.plugin.zsh @@ -0,0 +1,195 @@ +: ${NGINX_DIR:=/etc/nginx} +: ${NGINX_VHOST_TEMPLATE:=$ZSH/plugins/nginx/templates/symfony2} + +if [ $use_sudo -eq 1 ]; then + sudo="sudo" +else + sudo="" +fi + +# nginx basic completition + +_nginx_get_en_command_list () { + ls -a $NGINX_DIR/sites-available | awk '/^[a-z][a-z.-]+$/ { print $1 }' +} + +_nginx_get_dis_command_list () { + ls -a $NGINX_DIR/sites-enabled | awk '/^[a-z][a-z.-]+$/ { print $1 }' +} + +_nginx_en () { + compadd `_nginx_get_en_command_list` +} + +_nginx_dis () { + compadd `_nginx_get_dis_command_list` +} + +# Enabling a site +en () { + if [ ! $1 ]; then + echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m"; + return + fi + + if [ ! -e $NGINX_DIR/sites-available/$1 ]; then + echo "\033[31m$1\033[0m doesn't exist"; + return + fi + + if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then + $sudo ln -s $NGINX_DIR/sites-available/$1 $NGINX_DIR/sites-enabled/$1; + if [ -e /etc/nginx/sites-enabled/$1 ]; then + echo "\033[32m$1\033[0m successfully enabled"; + else + echo "An error occured during the enabling of \033[31m$1\033[0m"; + fi + else + echo "\033[31m$1\033[0m is already enabled"; + fi +} +compdef _nginx_en en + +# Disabling a site +dis () { + if [ ! $1 ]; then + echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m"; + return + fi + + if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then + echo "\033[31m$1\033[0m doesn't exist"; + else + $sudo rm -f $NGINX_DIR/sites-enabled/$1; + if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then + echo "\033[32m$1\033[0m successfully disabled"; + else + echo "An error occured during the disabling of \033[31m$1\033[0m"; + fi + fi +} +compdef _nginx_dis dis + +# Completition of vhost +_nginx_get_possible_vhost_list () { + ls -a $HOME/www | awk '/^[^.][a-z0-9._]+$/ { print $1 }' +} + +_nginx_vhost () { + compadd `_nginx_get_possible_vhost_list` +} + +# Parsing arguments +vhost () { + user=$USER; + template=$NGINX_VHOST_TEMPLATE + tpl="non_existing_template" + enable=1 + write_hosts=0 + args="" + + while getopts ":lu:t:nwh" option + do + case $option in + l ) ls $NGINX_DIR/sites-enabled; return ;; + u ) user=$OPTARG; args="$args -u $OPTARG" ;; + t ) tpl=$OPTARG; args="$args -t $OPTARG" ;; + n ) enable=0; args="$args -n" ;; + w ) write_hosts=1; args="$args -w" ;; + h ) _vhost_usage; return ;; + esac + done + + vhost=${@: -1} + vhostNotGiven=0 + + if [ ! $vhost ]; then + vhostNotGiven=1 + else + if [ $(echo $args | grep -o $vhost) ]; then + vhostNotGiven=1 + fi + fi + + if [ $vhostNotGiven -eq 1 ]; then + echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m" + return + fi + + if [ -e $ZSH/plugins/nginx/templates/$tpl ]; then + template=$ZSH/plugins/nginx/templates/$tpl + elif [ -e $tpl ]; then + template=$tpl + fi + + _vhost_generate $vhost $user + + if [ $enable -eq 1 ]; then + en $vhost + fi + + if [ $write_hosts -eq 1 ]; then + _write_hosts $vhost + fi +} +compdef _nginx_vhost vhost + +_vhost_usage () { + echo "Usage: vhost [options] [vhost_name]" + echo + echo "Options" + echo " -l Lists enabled vhosts" + echo " -u Sets the user - defaults to the current user ($USER)" + echo " -t Sets the template" + echo " -n Does not enable the generated vhost" + echo " -w Write the vhost to the /etc/hosts file pointing to 127.0.0.1 (writes it at the end of the first line actually)" + echo " -h Get this help message" + return +} + +# Generate config file +_vhost_generate () { + user=$(cat /etc/passwd | grep $2 | awk -F : '{print $1 }') + + if [ ! $user ]; then + echo "User \033[31m$2\033[0m doesn't have an account on \033[33m$HOST\033[0m" + return + fi + + echo "Generating \033[32m$1\033[0m vhost for \033[33m$user\033[0m user" + + user_id=$(cat /etc/passwd | grep $2 | awk -F : '{print $3 }') + pool_port=1$user_id + + conf=$(sed -e 's/{vhost}/'$1'/g' -e 's/{user}/'$user'/g' -e 's/{pool_port}/'$pool_port'/g' $template ) + + echo $conf > $1.tmp + $sudo mv $1.tmp $NGINX_DIR/sites-available/$1 + + if [ -e $NGINX_DIR/sites-available/$1 ]; then + echo "\033[32m$1\033[0m vhost has been successfully created" + else + echo "An error occured during the creating of \033[31m$1\033[0m vhost" + fi +} + +# Write the /etc/hosts file +_write_hosts () { + temp=$HOME/hosts.temp + exec < /etc/hosts + while read line + do + if [ -e $temp ]; then + echo "$line" >> $temp; + else + echo "$line $1" > $temp; + fi + done + + $sudo mv $temp /etc/hosts; + + "\033[32m$1\033[0m vhost has been successfully written in /etc/hosts" +} + +alias ngt="$sudo nginx -t" +alias ngr="$sudo service nginx restart" diff --git a/plugins/nginx/templates/plain_php b/plugins/nginx/templates/plain_php new file mode 100644 index 000000000..f7995f5d5 --- /dev/null +++ b/plugins/nginx/templates/plain_php @@ -0,0 +1,27 @@ +server { + root /home/{user}/www/{vhost}; + index index.php; + + server_name {vhost}; + + error_log /var/log/nginx/{vhost}.error.log; + access_log /var/log/nginx/{vhost}.access.log; + + location / { + try_files $uri $uri/ $uri/index.php; + } + + location ~ \.php$ { + include fastcgi_params; + fastcgi_index index.php; + fastcgi_pass 127.0.0.1:{pool_port}; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTPS off; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/plugins/nginx/templates/symfony2 b/plugins/nginx/templates/symfony2 new file mode 100644 index 000000000..4d5754ca1 --- /dev/null +++ b/plugins/nginx/templates/symfony2 @@ -0,0 +1,27 @@ +server { + root /home/{user}/www/{vhost}/web; + index app_dev.php; + + server_name {vhost}; + client_max_body_size 10M; + + error_log /var/log/nginx/{vhost}.error.log; + access_log /var/log/nginx/{vhost}.access.log; + + location / { + try_files $uri $uri/ /app_dev.php; + } + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:{pool_port} + location ~ ^/(app|app_dev|check)\.php(/|$) { + fastcgi_pass 127.0.0.1:{pool_port}; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTPS off; + } + + location ~ /\.ht { + deny all; + } +} diff --git a/plugins/php-fpm/php-fpm.plugin.zsh b/plugins/php-fpm/php-fpm.plugin.zsh new file mode 100644 index 000000000..3c095058a --- /dev/null +++ b/plugins/php-fpm/php-fpm.plugin.zsh @@ -0,0 +1,75 @@ +: ${FPM_DIR:=/etc/php5/fpm} + +if [ $use_sudo -eq 1 ]; then + sudo="sudo" +else + sudo="" +fi + +_fpm_get_possible_pool_list () { + cat /etc/passwd | awk -F : '{print $1 }' +} + +_fpm_pool () { + compadd `_fpm_get_possible_pool_list` + +} + +pool () { + while getopts ":lh" option + do + case $option in + l ) ls $FPM_DIR/pool.d; return ;; + h ) _pool_usage; return ;; + * ) _pool_usage; return ;; # Default. + esac + done + + if [ ! $1 ]; then + user=$USER + else + user=$1 + fi + + _pool_generate $user +} +compdef _fpm_pool pool + +_pool_usage () { + echo "Usage: pool [options] [user]" + echo + echo "Options" + echo " -l Lists fpm pools" + echo " -h Get this help message" + return +} + +_pool_generate () { + user=$(cat /etc/passwd | grep $1 | awk -F : '{print $1 }') + + if [ ! $user ]; then + echo "User \033[31m$1\033[0m doesn't have an account on \033[33m$HOST\033[0m" + return + fi + + group=$(groups $user | cut -d " " -f 3) + + echo "Generating pool for \033[33m$user\033[0m user with \033[33m$group\033[0m group" + + user_id=$(cat /etc/passwd | grep $1 | awk -F : '{print $3 }') + pool_port=1$user_id + : ${FPM_POOL_TEMPLATE:=$ZSH/plugins/php-fpm/templates/pool} + + conf=$(sed -e 's/{user}/'$user'/g' -e 's/{group}/'$group'/g' -e 's/{pool_port}/'$pool_port'/g' $FPM_POOL_TEMPLATE ) + + echo $conf > $user.conf + $sudo mv $user.conf $FPM_DIR/pool.d/$user.conf + + if [ -e $FPM_DIR/pool.d/$user.conf ]; then + echo "Pool for \033[32m$user\033[0m user has been successfully created" + else + echo "An error occured during the creating of pool for \033[31m$user\033[0m user" + fi +} + +alias fpmr="$sudo service php5-fpm restart" diff --git a/plugins/php-fpm/templates/pool b/plugins/php-fpm/templates/pool new file mode 100644 index 000000000..80f6693e0 --- /dev/null +++ b/plugins/php-fpm/templates/pool @@ -0,0 +1,11 @@ +[{user}] +user = {user} +group = {group} + +listen = 127.0.0.1:{pool_port} + +pm = dynamic +pm.max_children = 10 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +pm.max_requests = 100 From 91303246ecb4f103a1a3e21dfd9bcb65d1d5e832 Mon Sep 17 00:00:00 2001 From: mikka Date: Fri, 7 Sep 2012 22:15:43 +0200 Subject: [PATCH 07/82] added lesscss plugin --- plugins/lesscss/lesscss.plugin.zsh | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 plugins/lesscss/lesscss.plugin.zsh diff --git a/plugins/lesscss/lesscss.plugin.zsh b/plugins/lesscss/lesscss.plugin.zsh new file mode 100644 index 000000000..6c666adb2 --- /dev/null +++ b/plugins/lesscss/lesscss.plugin.zsh @@ -0,0 +1,46 @@ +# basics taken from here: +# http://www.ravelrumba.com/blog/watch-compile-less-command-line/comment-page-1/#comment-2464 +# Requires watchr: https://github.com/mynyml/watchr + +watchless () { + compressed=0 + compile="" + + while getopts ":xc:h" option + do + case $option in + x ) compressed=1 ;; + c ) compile=$OPTARG ;; + h ) _watchless_usage; return ;; + esac + done + + if [ $compressed -eq 1 ]; then + x=' -x' + else + x='' + fi + + if [ -n "$compile" ]; then + if [ ! -e $compile ]; then + echo "\033[337;41m\n$compile doesn't exist!\n\033[0m" + return + fi + + name=$(echo $compile | cut -d . -f 1) + + watchr -e 'watch(".*\.less$") { |f| system("lessc '$name'.less > '$name'.css'$x' && echo \"'$name'.less > '$name'.css\" ") }' + else + watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css'$x' && echo \"#{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css\" ") }' + fi +} + +_watchless_usage () { + echo "Usage: watchless [options]" + echo + echo "Options" + echo " -x Compiles less files into minified css files" + echo " -c Watch all files but compile only the one given here" + echo " -h Get this help message" + return +} From 08f4d8b9ce43bae69a2d712456cc6bde68b4f0d1 Mon Sep 17 00:00:00 2001 From: mikka Date: Tue, 11 Sep 2012 22:04:56 +0200 Subject: [PATCH 08/82] fixed nginx vhost template, made variables local, imroved parameter validation --- plugins/nginx/nginx.plugin.zsh | 49 +++++++++++++------------------- plugins/nginx/templates/symfony2 | 2 +- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/plugins/nginx/nginx.plugin.zsh b/plugins/nginx/nginx.plugin.zsh index 6dd90c6d5..4d2c4122d 100644 --- a/plugins/nginx/nginx.plugin.zsh +++ b/plugins/nginx/nginx.plugin.zsh @@ -81,45 +81,36 @@ _nginx_vhost () { # Parsing arguments vhost () { - user=$USER; - template=$NGINX_VHOST_TEMPLATE - tpl="non_existing_template" - enable=1 - write_hosts=0 - args="" + local user=$USER; + local template=$NGINX_VHOST_TEMPLATE + local tpl="non_existing_template" + local enable=1 + local write_hosts=0 while getopts ":lu:t:nwh" option do case $option in l ) ls $NGINX_DIR/sites-enabled; return ;; - u ) user=$OPTARG; args="$args -u $OPTARG" ;; - t ) tpl=$OPTARG; args="$args -t $OPTARG" ;; - n ) enable=0; args="$args -n" ;; - w ) write_hosts=1; args="$args -w" ;; + u ) user=$OPTARG ;; + t ) tpl=$OPTARG ;; + n ) enable=0 ;; + w ) write_hosts=1 ;; h ) _vhost_usage; return ;; esac done - vhost=${@: -1} - vhostNotGiven=0 - - if [ ! $vhost ]; then - vhostNotGiven=1 - else - if [ $(echo $args | grep -o $vhost) ]; then - vhostNotGiven=1 - fi - fi - - if [ $vhostNotGiven -eq 1 ]; then + shift $[ $OPTIND - 1 ] + local vhost=$1 + + if [ -z "$vhost" ]; then echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m" return fi if [ -e $ZSH/plugins/nginx/templates/$tpl ]; then - template=$ZSH/plugins/nginx/templates/$tpl + local template=$ZSH/plugins/nginx/templates/$tpl elif [ -e $tpl ]; then - template=$tpl + local template=$tpl fi _vhost_generate $vhost $user @@ -149,7 +140,7 @@ _vhost_usage () { # Generate config file _vhost_generate () { - user=$(cat /etc/passwd | grep $2 | awk -F : '{print $1 }') + local user=$(cat /etc/passwd | grep $2 | awk -F : '{print $1 }') if [ ! $user ]; then echo "User \033[31m$2\033[0m doesn't have an account on \033[33m$HOST\033[0m" @@ -158,10 +149,10 @@ _vhost_generate () { echo "Generating \033[32m$1\033[0m vhost for \033[33m$user\033[0m user" - user_id=$(cat /etc/passwd | grep $2 | awk -F : '{print $3 }') - pool_port=1$user_id + local user_id=$(cat /etc/passwd | grep $2 | awk -F : '{print $3 }') + local pool_port=1$user_id - conf=$(sed -e 's/{vhost}/'$1'/g' -e 's/{user}/'$user'/g' -e 's/{pool_port}/'$pool_port'/g' $template ) + local conf=$(sed -e 's/{vhost}/'$1'/g' -e 's/{user}/'$user'/g' -e 's/{pool_port}/'$pool_port'/g' $template ) echo $conf > $1.tmp $sudo mv $1.tmp $NGINX_DIR/sites-available/$1 @@ -188,7 +179,7 @@ _write_hosts () { $sudo mv $temp /etc/hosts; - "\033[32m$1\033[0m vhost has been successfully written in /etc/hosts" + echo "\033[32m$1\033[0m vhost has been successfully written in /etc/hosts" } alias ngt="$sudo nginx -t" diff --git a/plugins/nginx/templates/symfony2 b/plugins/nginx/templates/symfony2 index 4d5754ca1..c2eeaec0a 100644 --- a/plugins/nginx/templates/symfony2 +++ b/plugins/nginx/templates/symfony2 @@ -9,7 +9,7 @@ server { access_log /var/log/nginx/{vhost}.access.log; location / { - try_files $uri $uri/ /app_dev.php; + try_files $uri $uri/ /app_dev.php$uri /app_dev.php$is_args$args; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:{pool_port} From dde4a8b6a3aaa69feb3243bb374a0af07fb5d033 Mon Sep 17 00:00:00 2001 From: Nandor Kracser Date: Fri, 28 Dec 2012 12:28:47 +0100 Subject: [PATCH 09/82] Maven plugin completion fix for other (than Java) JVM languages --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index da29b4f0a..c2d8e7ed7 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -163,7 +163,7 @@ function listMavenCompletions { cli:execute cli:execute-phase archetype:generate generate-sources 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` ); } From c5d575ccae5ae5f30dd59037210edb8220de2cbe Mon Sep 17 00:00:00 2001 From: mikka Date: Thu, 3 Jan 2013 07:07:40 +0100 Subject: [PATCH 10/82] cleaned up --- plugins/lesscss/lesscss.plugin.zsh | 46 ------- plugins/nginx/nginx.plugin.zsh | 186 ----------------------------- plugins/nginx/templates/plain_php | 27 ----- plugins/nginx/templates/symfony2 | 27 ----- plugins/php-fpm/php-fpm.plugin.zsh | 75 ------------ plugins/php-fpm/templates/pool | 11 -- 6 files changed, 372 deletions(-) delete mode 100644 plugins/lesscss/lesscss.plugin.zsh delete mode 100644 plugins/nginx/nginx.plugin.zsh delete mode 100644 plugins/nginx/templates/plain_php delete mode 100644 plugins/nginx/templates/symfony2 delete mode 100644 plugins/php-fpm/php-fpm.plugin.zsh delete mode 100644 plugins/php-fpm/templates/pool diff --git a/plugins/lesscss/lesscss.plugin.zsh b/plugins/lesscss/lesscss.plugin.zsh deleted file mode 100644 index 6c666adb2..000000000 --- a/plugins/lesscss/lesscss.plugin.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# basics taken from here: -# http://www.ravelrumba.com/blog/watch-compile-less-command-line/comment-page-1/#comment-2464 -# Requires watchr: https://github.com/mynyml/watchr - -watchless () { - compressed=0 - compile="" - - while getopts ":xc:h" option - do - case $option in - x ) compressed=1 ;; - c ) compile=$OPTARG ;; - h ) _watchless_usage; return ;; - esac - done - - if [ $compressed -eq 1 ]; then - x=' -x' - else - x='' - fi - - if [ -n "$compile" ]; then - if [ ! -e $compile ]; then - echo "\033[337;41m\n$compile doesn't exist!\n\033[0m" - return - fi - - name=$(echo $compile | cut -d . -f 1) - - watchr -e 'watch(".*\.less$") { |f| system("lessc '$name'.less > '$name'.css'$x' && echo \"'$name'.less > '$name'.css\" ") }' - else - watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css'$x' && echo \"#{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css\" ") }' - fi -} - -_watchless_usage () { - echo "Usage: watchless [options]" - echo - echo "Options" - echo " -x Compiles less files into minified css files" - echo " -c Watch all files but compile only the one given here" - echo " -h Get this help message" - return -} diff --git a/plugins/nginx/nginx.plugin.zsh b/plugins/nginx/nginx.plugin.zsh deleted file mode 100644 index 4d2c4122d..000000000 --- a/plugins/nginx/nginx.plugin.zsh +++ /dev/null @@ -1,186 +0,0 @@ -: ${NGINX_DIR:=/etc/nginx} -: ${NGINX_VHOST_TEMPLATE:=$ZSH/plugins/nginx/templates/symfony2} - -if [ $use_sudo -eq 1 ]; then - sudo="sudo" -else - sudo="" -fi - -# nginx basic completition - -_nginx_get_en_command_list () { - ls -a $NGINX_DIR/sites-available | awk '/^[a-z][a-z.-]+$/ { print $1 }' -} - -_nginx_get_dis_command_list () { - ls -a $NGINX_DIR/sites-enabled | awk '/^[a-z][a-z.-]+$/ { print $1 }' -} - -_nginx_en () { - compadd `_nginx_get_en_command_list` -} - -_nginx_dis () { - compadd `_nginx_get_dis_command_list` -} - -# Enabling a site -en () { - if [ ! $1 ]; then - echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m"; - return - fi - - if [ ! -e $NGINX_DIR/sites-available/$1 ]; then - echo "\033[31m$1\033[0m doesn't exist"; - return - fi - - if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then - $sudo ln -s $NGINX_DIR/sites-available/$1 $NGINX_DIR/sites-enabled/$1; - if [ -e /etc/nginx/sites-enabled/$1 ]; then - echo "\033[32m$1\033[0m successfully enabled"; - else - echo "An error occured during the enabling of \033[31m$1\033[0m"; - fi - else - echo "\033[31m$1\033[0m is already enabled"; - fi -} -compdef _nginx_en en - -# Disabling a site -dis () { - if [ ! $1 ]; then - echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m"; - return - fi - - if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then - echo "\033[31m$1\033[0m doesn't exist"; - else - $sudo rm -f $NGINX_DIR/sites-enabled/$1; - if [ ! -e $NGINX_DIR/sites-enabled/$1 ]; then - echo "\033[32m$1\033[0m successfully disabled"; - else - echo "An error occured during the disabling of \033[31m$1\033[0m"; - fi - fi -} -compdef _nginx_dis dis - -# Completition of vhost -_nginx_get_possible_vhost_list () { - ls -a $HOME/www | awk '/^[^.][a-z0-9._]+$/ { print $1 }' -} - -_nginx_vhost () { - compadd `_nginx_get_possible_vhost_list` -} - -# Parsing arguments -vhost () { - local user=$USER; - local template=$NGINX_VHOST_TEMPLATE - local tpl="non_existing_template" - local enable=1 - local write_hosts=0 - - while getopts ":lu:t:nwh" option - do - case $option in - l ) ls $NGINX_DIR/sites-enabled; return ;; - u ) user=$OPTARG ;; - t ) tpl=$OPTARG ;; - n ) enable=0 ;; - w ) write_hosts=1 ;; - h ) _vhost_usage; return ;; - esac - done - - shift $[ $OPTIND - 1 ] - local vhost=$1 - - if [ -z "$vhost" ]; then - echo "\033[337;41m\nThe name of the vhost is required!\n\033[0m" - return - fi - - if [ -e $ZSH/plugins/nginx/templates/$tpl ]; then - local template=$ZSH/plugins/nginx/templates/$tpl - elif [ -e $tpl ]; then - local template=$tpl - fi - - _vhost_generate $vhost $user - - if [ $enable -eq 1 ]; then - en $vhost - fi - - if [ $write_hosts -eq 1 ]; then - _write_hosts $vhost - fi -} -compdef _nginx_vhost vhost - -_vhost_usage () { - echo "Usage: vhost [options] [vhost_name]" - echo - echo "Options" - echo " -l Lists enabled vhosts" - echo " -u Sets the user - defaults to the current user ($USER)" - echo " -t Sets the template" - echo " -n Does not enable the generated vhost" - echo " -w Write the vhost to the /etc/hosts file pointing to 127.0.0.1 (writes it at the end of the first line actually)" - echo " -h Get this help message" - return -} - -# Generate config file -_vhost_generate () { - local user=$(cat /etc/passwd | grep $2 | awk -F : '{print $1 }') - - if [ ! $user ]; then - echo "User \033[31m$2\033[0m doesn't have an account on \033[33m$HOST\033[0m" - return - fi - - echo "Generating \033[32m$1\033[0m vhost for \033[33m$user\033[0m user" - - local user_id=$(cat /etc/passwd | grep $2 | awk -F : '{print $3 }') - local pool_port=1$user_id - - local conf=$(sed -e 's/{vhost}/'$1'/g' -e 's/{user}/'$user'/g' -e 's/{pool_port}/'$pool_port'/g' $template ) - - echo $conf > $1.tmp - $sudo mv $1.tmp $NGINX_DIR/sites-available/$1 - - if [ -e $NGINX_DIR/sites-available/$1 ]; then - echo "\033[32m$1\033[0m vhost has been successfully created" - else - echo "An error occured during the creating of \033[31m$1\033[0m vhost" - fi -} - -# Write the /etc/hosts file -_write_hosts () { - temp=$HOME/hosts.temp - exec < /etc/hosts - while read line - do - if [ -e $temp ]; then - echo "$line" >> $temp; - else - echo "$line $1" > $temp; - fi - done - - $sudo mv $temp /etc/hosts; - - echo "\033[32m$1\033[0m vhost has been successfully written in /etc/hosts" -} - -alias ngt="$sudo nginx -t" -alias ngr="$sudo service nginx restart" diff --git a/plugins/nginx/templates/plain_php b/plugins/nginx/templates/plain_php deleted file mode 100644 index f7995f5d5..000000000 --- a/plugins/nginx/templates/plain_php +++ /dev/null @@ -1,27 +0,0 @@ -server { - root /home/{user}/www/{vhost}; - index index.php; - - server_name {vhost}; - - error_log /var/log/nginx/{vhost}.error.log; - access_log /var/log/nginx/{vhost}.access.log; - - location / { - try_files $uri $uri/ $uri/index.php; - } - - location ~ \.php$ { - include fastcgi_params; - fastcgi_index index.php; - fastcgi_pass 127.0.0.1:{pool_port}; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param HTTPS off; - } - - location ~ /\.ht { - deny all; - } -} diff --git a/plugins/nginx/templates/symfony2 b/plugins/nginx/templates/symfony2 deleted file mode 100644 index c2eeaec0a..000000000 --- a/plugins/nginx/templates/symfony2 +++ /dev/null @@ -1,27 +0,0 @@ -server { - root /home/{user}/www/{vhost}/web; - index app_dev.php; - - server_name {vhost}; - client_max_body_size 10M; - - error_log /var/log/nginx/{vhost}.error.log; - access_log /var/log/nginx/{vhost}.access.log; - - location / { - try_files $uri $uri/ /app_dev.php$uri /app_dev.php$is_args$args; - } - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:{pool_port} - location ~ ^/(app|app_dev|check)\.php(/|$) { - fastcgi_pass 127.0.0.1:{pool_port}; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param HTTPS off; - } - - location ~ /\.ht { - deny all; - } -} diff --git a/plugins/php-fpm/php-fpm.plugin.zsh b/plugins/php-fpm/php-fpm.plugin.zsh deleted file mode 100644 index 3c095058a..000000000 --- a/plugins/php-fpm/php-fpm.plugin.zsh +++ /dev/null @@ -1,75 +0,0 @@ -: ${FPM_DIR:=/etc/php5/fpm} - -if [ $use_sudo -eq 1 ]; then - sudo="sudo" -else - sudo="" -fi - -_fpm_get_possible_pool_list () { - cat /etc/passwd | awk -F : '{print $1 }' -} - -_fpm_pool () { - compadd `_fpm_get_possible_pool_list` - -} - -pool () { - while getopts ":lh" option - do - case $option in - l ) ls $FPM_DIR/pool.d; return ;; - h ) _pool_usage; return ;; - * ) _pool_usage; return ;; # Default. - esac - done - - if [ ! $1 ]; then - user=$USER - else - user=$1 - fi - - _pool_generate $user -} -compdef _fpm_pool pool - -_pool_usage () { - echo "Usage: pool [options] [user]" - echo - echo "Options" - echo " -l Lists fpm pools" - echo " -h Get this help message" - return -} - -_pool_generate () { - user=$(cat /etc/passwd | grep $1 | awk -F : '{print $1 }') - - if [ ! $user ]; then - echo "User \033[31m$1\033[0m doesn't have an account on \033[33m$HOST\033[0m" - return - fi - - group=$(groups $user | cut -d " " -f 3) - - echo "Generating pool for \033[33m$user\033[0m user with \033[33m$group\033[0m group" - - user_id=$(cat /etc/passwd | grep $1 | awk -F : '{print $3 }') - pool_port=1$user_id - : ${FPM_POOL_TEMPLATE:=$ZSH/plugins/php-fpm/templates/pool} - - conf=$(sed -e 's/{user}/'$user'/g' -e 's/{group}/'$group'/g' -e 's/{pool_port}/'$pool_port'/g' $FPM_POOL_TEMPLATE ) - - echo $conf > $user.conf - $sudo mv $user.conf $FPM_DIR/pool.d/$user.conf - - if [ -e $FPM_DIR/pool.d/$user.conf ]; then - echo "Pool for \033[32m$user\033[0m user has been successfully created" - else - echo "An error occured during the creating of pool for \033[31m$user\033[0m user" - fi -} - -alias fpmr="$sudo service php5-fpm restart" diff --git a/plugins/php-fpm/templates/pool b/plugins/php-fpm/templates/pool deleted file mode 100644 index 80f6693e0..000000000 --- a/plugins/php-fpm/templates/pool +++ /dev/null @@ -1,11 +0,0 @@ -[{user}] -user = {user} -group = {group} - -listen = 127.0.0.1:{pool_port} - -pm = dynamic -pm.max_children = 10 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 -pm.max_requests = 100 From df7cae0f4fdd8221d6cf256cc29c48b1d0d54dbd Mon Sep 17 00:00:00 2001 From: mikka Date: Thu, 3 Jan 2013 07:18:38 +0100 Subject: [PATCH 11/82] moved bower plugin to a separate branch --- plugins/bower/bower.plugin.zsh | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plugins/bower/bower.plugin.zsh diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh new file mode 100644 index 000000000..ed9c04840 --- /dev/null +++ b/plugins/bower/bower.plugin.zsh @@ -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 From 8e9cf45200391db787b3a25ae00f4352d7a11e8e Mon Sep 17 00:00:00 2001 From: Yohann Bianchi Date: Sat, 19 Jan 2013 00:52:09 +0100 Subject: [PATCH 12/82] ADDED: Mercurial repository info --- themes/agnoster.zsh-theme | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index c3107c06c..7ce5a77f8 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -83,6 +83,25 @@ prompt_git() { fi } +prompt_hg() { + local rev status + if $(hg id >/dev/null 2>&1); then + if $(hg prompt >/dev/null 2>&1); then + rev=$(hg prompt {status}) + if [[ $rev = "?" ]]; then + prompt_segment red white + rev='±' + elif [[ -n $rev ]]; then + prompt_segment yellow black + rev='±' + else + prompt_segment green black + fi + fi + echo -n $(hg prompt "⭠ {rev}@{branch}") $rev + fi +} + # Dir: current working directory prompt_dir() { prompt_segment blue black '%~' @@ -109,6 +128,7 @@ build_prompt() { prompt_context prompt_dir prompt_git + prompt_hg prompt_end } From 28b737416fe1eadd1a0e0bad460941651ac20e49 Mon Sep 17 00:00:00 2001 From: Yohann Bianchi Date: Sun, 20 Jan 2013 13:10:31 +0100 Subject: [PATCH 13/82] ADDED: Mercurial prompt info support even if hg prompt extension is unavailable --- themes/agnoster.zsh-theme | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 7ce5a77f8..e2074b713 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -87,18 +87,35 @@ prompt_hg() { local rev status if $(hg id >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then - rev=$(hg prompt {status}) - if [[ $rev = "?" ]]; then + st=$(hg prompt {status}) + if [[ $st = "?" ]]; then + # if files are not added prompt_segment red white - rev='±' - elif [[ -n $rev ]]; then + st='±' + elif [[ -n $st ]]; then + # if any modification prompt_segment yellow black - rev='±' + 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 - echo -n $(hg prompt "⭠ {rev}@{branch}") $rev fi } From 6d762fa053154a10befec1a42c963fff072ebece Mon Sep 17 00:00:00 2001 From: Florent Thoumie Date: Wed, 30 Jan 2013 05:16:26 -0800 Subject: [PATCH 14/82] Add new profiles plugin. Depending on the machine you're logged into, you may want to use specific configuration. Add 'profiles' to your list of plugin will try to find a profile for the local machine and each (sub)domain it belongs to. --- plugins/profiles/profiles.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/profiles/profiles.plugin.zsh diff --git a/plugins/profiles/profiles.plugin.zsh b/plugins/profiles/profiles.plugin.zsh new file mode 100644 index 000000000..8faae6b53 --- /dev/null +++ b/plugins/profiles/profiles.plugin.zsh @@ -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 From 631a8473e2f3f20e1414dff4e409fe07cbb41aea Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Tue, 5 Feb 2013 09:45:00 +0100 Subject: [PATCH 15/82] added pj.plugin --- plugins/pj/pj.plugin.zsh | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 plugins/pj/pj.plugin.zsh diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh new file mode 100644 index 000000000..ba3765b83 --- /dev/null +++ b/plugins/pj/pj.plugin.zsh @@ -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 From a5a6f6bb6c95422964f9fe9b8e19d1a830202733 Mon Sep 17 00:00:00 2001 From: Eric Kelly Date: Thu, 7 Feb 2013 16:26:41 -0500 Subject: [PATCH 16/82] add alias for rspec to zeus plugin --- plugins/zeus/README.md | 2 ++ plugins/zeus/zeus.plugin.zsh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md index 4409943fe..d7c2aef80 100644 --- a/plugins/zeus/README.md +++ b/plugins/zeus/README.md @@ -25,6 +25,8 @@ * `zcu` aliases `zeus cucumber` * `zucumber` aliases `zeus cucumber` +* `zspec` aliases `zeus rspec` + * `zt` aliases `zeus test` * `zest` aliases `zeus test` diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh index 2fc7e1ebf..1658b34d3 100644 --- a/plugins/zeus/zeus.plugin.zsh +++ b/plugins/zeus/zeus.plugin.zsh @@ -4,7 +4,7 @@ # 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 +# 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' @@ -40,6 +40,9 @@ alias zunner='zeus runner' alias zcu='zeus cucumber' alias zucumber='zeus cucumber' +# Rspec +alias zspec='zeus rspec' + # Test alias zt='zeus test' alias zest='zeus test' From dace87ae361722c0332c18e5470ca10f16720f7f Mon Sep 17 00:00:00 2001 From: "Jesse B. Hannah" Date: Fri, 8 Feb 2013 19:11:40 -0700 Subject: [PATCH 17/82] Fix rbenv gems helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes gem versions with words (beta, pre) in the version or with multiple installed versions not being highlighted, and compatibility with GNU sed (related to robbyrussell/oh-my-zsh#1579). --- plugins/rbenv/rbenv.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index d855c2445..fb9df4bdd 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do 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" + gem list $@ | sed -E \ + -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ + -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" } function rbenv_prompt_info() { From 3d81ecfb43d0da18a3b89b5aa12a78c1ad91f063 Mon Sep 17 00:00:00 2001 From: Ian MacLeod Date: Fri, 8 Feb 2013 23:00:41 -0800 Subject: [PATCH 18/82] Support for Sublime Text 3, with fallback --- plugins/sublime/sublime.plugin.zsh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 1b2cbcdce..bfbc45a07 100755 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -1,7 +1,12 @@ # Sublime Text 2 Aliases -#unamestr = 'uname' -local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl +local _sublime_darwin_paths +_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 [ -f '/usr/bin/sublime_text' ]; then @@ -9,13 +14,15 @@ if [[ $('uname') == 'Linux' ]]; then else st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & } fi -alias st=st_run + alias st=st_run + elif [[ $('uname') == 'Darwin' ]]; then - # Check if Sublime is installed in user's home application directory - if [[ -a $HOME/${_sublime_darwin_subl} ]]; then - alias st='$HOME/${_sublime_darwin_subl}' - else - alias st='${_sublime_darwin_subl}' - fi + + for _sublime_path in $_sublime_darwin_paths; do + if [[ -a $_sublime_path ]]; then + alias st="'$_sublime_path'" + fi + done fi + alias stt='st .' From 06d5cb93ab043a244e98630fdd7b7378210c9b6f Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Mon, 11 Feb 2013 11:33:24 +0800 Subject: [PATCH 19/82] new plugin: start fbterm automatically in /dev/tty* --- plugins/fbterm/fbterm.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/fbterm/fbterm.plugin.zsh diff --git a/plugins/fbterm/fbterm.plugin.zsh b/plugins/fbterm/fbterm.plugin.zsh new file mode 100644 index 000000000..4f0456016 --- /dev/null +++ b/plugins/fbterm/fbterm.plugin.zsh @@ -0,0 +1,6 @@ +# start fbterm automatically in /dev/tty* + +if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then + fbterm + exit +fi From ccdc5518f00ba3b4f35cb05a0daeb4ab4efd2268 Mon Sep 17 00:00:00 2001 From: Peter Bomars Date: Thu, 14 Feb 2013 00:18:12 -0800 Subject: [PATCH 20/82] Update plugins/rvm/rvm.plugin.zsh 1) be gentle - first git pull request 2) added ruby 2.0.0 alias and function --- plugins/rvm/rvm.plugin.zsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 1ab800b0f..5000a49b3 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -4,7 +4,8 @@ alias rubies='rvm list rubies' alias gemsets='rvm gemset list' 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 { 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}'`} 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 { rvm get head rvm reload # TODO: Reload rvm completion? From 535fafde816b0c45521c5de2003ae9e0038cc424 Mon Sep 17 00:00:00 2001 From: Mirko Caserta Date: Fri, 15 Feb 2013 16:05:15 +0100 Subject: [PATCH 21/82] SBT and Scala plugins. The SBT (Simple Build Tool: scala-sbt.org) plugin is an original work of mine. The Scala (scala-lang.org) plugin was taken from zsh-lovers. --- plugins/sbt/_sbt | 55 ++++++++ plugins/sbt/sbt.plugin.zsh | 23 ++++ plugins/scala/_scala | 249 +++++++++++++++++++++++++++++++++++++ 3 files changed, 327 insertions(+) create mode 100644 plugins/sbt/_sbt create mode 100644 plugins/sbt/sbt.plugin.zsh create mode 100644 plugins/scala/_scala diff --git a/plugins/sbt/_sbt b/plugins/sbt/_sbt new file mode 100644 index 000000000..91372aa72 --- /dev/null +++ b/plugins/sbt/_sbt @@ -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 diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh new file mode 100644 index 000000000..203c691f5 --- /dev/null +++ b/plugins/sbt/sbt.plugin.zsh @@ -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' diff --git a/plugins/scala/_scala b/plugins/scala/_scala new file mode 100644 index 000000000..c4ccb37d3 --- /dev/null +++ b/plugins/scala/_scala @@ -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 +# +# ------------------------------------------------------------------------------ + +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 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 (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 name:_scala_phases" + "-Ycheck\:-[Check the tree at the end of ]:phase name:_scala_phases" + "-Ylog\:-[Log operations during ]:phase name:_scala_phases" + "-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases" + "-Yskip\:-[Skip ]:phase name:_scala_phases" + "-Ystop-after\:-[Stop after given phase ]:phase name:_scala_phases" + "-Ystop-before\:-[Stop before given 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 as if entered in the repl]:string" \ + "-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \ + "-i+[preload 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 From 2264c51355542df082c72468eea2dfa5a8e54ada Mon Sep 17 00:00:00 2001 From: ripdog Date: Fri, 15 Feb 2013 16:57:36 +0000 Subject: [PATCH 22/82] Update plugins/extract/extract.plugin.zsh Cause unrar to preserve directory structure. (Why is only unrar different?!) --- plugins/extract/extract.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 5c125e98b..23e86c593 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -53,7 +53,7 @@ function extract() { (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; (*.zip) unzip "$1" -d $extract_dir ;; - (*.rar) unrar e -ad "$1" ;; + (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) mkdir -p "$extract_dir/control" From 3db22634a1dfe6797b2dafabce82b27f101c8e6b Mon Sep 17 00:00:00 2001 From: Thomas Minor Date: Tue, 22 Jan 2013 09:02:21 -0800 Subject: [PATCH 23/82] pipe git version check error to /dev/null (for when git doesn't exist) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..bcd6cc055 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -112,7 +112,7 @@ function git_compare_version() { local INPUT_GIT_VERSION=$1; local INSTALLED_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]}); for i in {1..3}; do From b979400cff17248147d95f6271edb6f2d6e36c84 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 14:05:22 -0500 Subject: [PATCH 24/82] Starting tmux plugin with basic config variables. --- plugins/tmux/tmux.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/tmux/tmux.plugin.zsh diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh new file mode 100644 index 000000000..cc676cb92 --- /dev/null +++ b/plugins/tmux/tmux.plugin.zsh @@ -0,0 +1,12 @@ +# Configuration variables +# Automatically start tmux +[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART = false +# 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 = true +# Set term to screen or screen-256color based on current terminal support +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT = true + +# Get the absolute path to the current directory +local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" From 26ee66f179be08fab59d41a0522ad51610125c6c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 17:50:15 -0500 Subject: [PATCH 25/82] Adding main function and alias to tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 37 ++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index cc676cb92..a2f36c0be 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,12 +1,41 @@ # Configuration variables # Automatically start tmux -[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART = false +[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false # Automatically connect to a previous session if it exists -[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT = true +[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true # Automatically close the terminal when tmux exits -[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT = true +[[ -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_AUTOCONNECT = true +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT=true # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" + +# Local variable to store the local config file to use, if any. +local fixed_config="" + +# Set the correct local config file to use +if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] +then + if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] + then + fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf + else + fixed_config=$zsh_tmux_plugin_path/tmux.only.conf + fi +fi + +# Override tmux with our function +function zsh_tmux_plugin_start() +{ + if [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + then + \tmux attach || tmux -f $fixed_config new-session + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + else + \tmux -f $fixed_config + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + fi +} + +alias tmux=zsh_tmux_plugin_start From 3aef6793c2bf0c0afec1fdb97a3a56e7f8d065c6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:05:58 -0500 Subject: [PATCH 26/82] Now checking for 256 color terminal in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index a2f36c0be..f67c2b8b5 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -11,6 +11,14 @@ # 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="screen-256" +else + export $ZSH_TMUX_TERM="screen" +fi + # Local variable to store the local config file to use, if any. local fixed_config="" From 778ae57772a02d11c393708c4c0644fbd1ffac35 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:07:25 -0500 Subject: [PATCH 27/82] Tmux plugin now just runs tmux if any extra args are given. --- plugins/tmux/tmux.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index f67c2b8b5..d8fdd9255 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -36,7 +36,12 @@ fi # Override tmux with our function function zsh_tmux_plugin_start() { - if [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + # 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 -f $fixed_config new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit From 0cf871d51299a4f837e6dce4d4ae827b0c09f5bd Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:08:37 -0500 Subject: [PATCH 28/82] Adding comments to tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index d8fdd9255..48ffc1c27 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -27,8 +27,10 @@ if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] then if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then + #use this when they have a ~/.tmux.conf fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf else + #use this when they don't have a ~/.tmux.conf fixed_config=$zsh_tmux_plugin_path/tmux.only.conf fi fi @@ -45,6 +47,7 @@ function zsh_tmux_plugin_start() then \tmux attach || tmux -f $fixed_config new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + # Just try to fix the TERM variable. else \tmux -f $fixed_config [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit From 45a4db33f81c5dbdcafa25cfe5a75490d55ec185 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:09:01 -0500 Subject: [PATCH 29/82] Enabling autostart of tmux in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 48ffc1c27..8dd208399 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -55,3 +55,8 @@ function zsh_tmux_plugin_start() } alias tmux=zsh_tmux_plugin_start + +if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] +then + zsh_tmux_plugin_start +fi From bf40d4e354ce33c0d9f42cc64372461bff14cde8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:09:17 -0500 Subject: [PATCH 30/82] Adding helper tmux config files to tmux plugin. --- plugins/tmux/tmux.extra.conf | 2 ++ plugins/tmux/tmux.only.conf | 1 + 2 files changed, 3 insertions(+) create mode 100644 plugins/tmux/tmux.extra.conf create mode 100644 plugins/tmux/tmux.only.conf diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf new file mode 100644 index 000000000..beffd380c --- /dev/null +++ b/plugins/tmux/tmux.extra.conf @@ -0,0 +1,2 @@ +set -g default-terminal $ZSH_TMUX_TERM +source $HOME/.tmux.conf diff --git a/plugins/tmux/tmux.only.conf b/plugins/tmux/tmux.only.conf new file mode 100644 index 000000000..0734df3e1 --- /dev/null +++ b/plugins/tmux/tmux.only.conf @@ -0,0 +1 @@ +set -g default-terminal $ZSH_TMUX_TERM From 7b15627851983e63a5756f0b3633938c44ed7a7d Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 21:47:11 -0500 Subject: [PATCH 31/82] Fixing typos, logic, and gremlins in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8dd208399..46c142b77 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -6,7 +6,7 @@ # 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_AUTOCONNECT=true +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" @@ -14,49 +14,50 @@ 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="screen-256" + export ZSH_TMUX_TERM="screen-256color" else - export $ZSH_TMUX_TERM="screen" + export ZSH_TMUX_TERM="screen" fi # Local variable to store the local config file to use, if any. local fixed_config="" -# Set the correct local config file to use +# Set the correct local config file to use. if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] then if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then #use this when they have a ~/.tmux.conf - fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" else #use this when they don't have a ~/.tmux.conf - fixed_config=$zsh_tmux_plugin_path/tmux.only.conf + fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fi fi -# Override tmux with our function -function zsh_tmux_plugin_start() +# Wrapper function for tmux. +function zsh_tmux_plugin_run() { # We have other arguments, just run them - if [[ ! -n "$@" ]] + if [[ -n "$@" ]] then \tmux $@ # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux attach || tmux -f $fixed_config new-session + \tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit - # Just try to fix the TERM variable. + # Just run tmux, fixing the TERM variable if requested. else - \tmux -f $fixed_config + \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } +# Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] then - zsh_tmux_plugin_start + zsh_tmux_plugin_run fi From 43c50f03e3c547ec51feef7ae3c99f734a66e6a6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 21:52:26 -0500 Subject: [PATCH 32/82] Checking environment instead of local variable for fixing term in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 46c142b77..9a52e6376 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -23,16 +23,13 @@ fi local fixed_config="" # Set the correct local config file to use. -if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] +if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then - if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] - then - #use this when they have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" - else - #use this when they don't have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" - fi + #use this when they have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" +else + #use this when they don't have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fi # Wrapper function for tmux. @@ -45,11 +42,11 @@ function zsh_tmux_plugin_run() # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session + \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit # Just run tmux, fixing the TERM variable if requested. else - \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` + \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } From f096644c751cb7fe566e82de531435a405d76be8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:03:22 -0500 Subject: [PATCH 33/82] Checking if already in tmux before autostarting in tmux in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 9a52e6376..8bdd92133 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -54,7 +54,7 @@ function zsh_tmux_plugin_run() # Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start -if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] +if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] then zsh_tmux_plugin_run fi From 691630a89586c86dfafa32974c5c6dbaa1356c07 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:18:36 -0500 Subject: [PATCH 34/82] Adding option to prevent autostarting tmux more than once in the same session. --- plugins/tmux/tmux.plugin.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8bdd92133..a7bf93dbd 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,6 +1,10 @@ # 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 @@ -8,6 +12,7 @@ # Set term to screen or screen-256color based on current terminal support [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true + # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" @@ -54,7 +59,13 @@ function zsh_tmux_plugin_run() # Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start +# Autostart if not already in tmux and enabled. if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] then - zsh_tmux_plugin_run + # 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 From 56c46c4ed8339c66c671927c197eb4511b5a664c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:55:18 -0500 Subject: [PATCH 35/82] Fixing typo in alias. --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index a7bf93dbd..982f87356 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -57,7 +57,7 @@ function zsh_tmux_plugin_run() } # Alias tmux to our wrapper function. -alias tmux=zsh_tmux_plugin_start +alias tmux=zsh_tmux_plugin_run # Autostart if not already in tmux and enabled. if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] From 86c9b32031dc28b4c6a641a4475e0e55c7ff32e5 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:57:37 -0500 Subject: [PATCH 36/82] Adding compdef to maintain tmux completions. --- plugins/tmux/tmux.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 982f87356..5c4076904 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -56,6 +56,9 @@ function zsh_tmux_plugin_run() 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 From 4e8681c6e19f77a9b54ceee5934e3356e4ffb207 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 23:35:45 -0500 Subject: [PATCH 37/82] Adding options to choose tmux TERM for 256 and non-256 color terminals. This may be needed on systems that don't have the proper terminfo for screen and/or screen-256color. Otherwise the defaults of screen and screen-256color should be fine. --- plugins/tmux/tmux.plugin.zsh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 5c4076904..be92fe096 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -11,6 +11,14 @@ [[ -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 @@ -19,9 +27,9 @@ 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="screen-256color" + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else - export ZSH_TMUX_TERM="screen" + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi # Local variable to store the local config file to use, if any. From f0a920df5a4a5e5260ef45daf27d42a15cd75217 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 27 Feb 2013 10:21:19 -0500 Subject: [PATCH 38/82] Checking to make sure tmux is actually installed before running plugin. If it is not found an error message is printed. --- plugins/tmux/tmux.plugin.zsh | 152 ++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 73 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index be92fe096..6f0d5902a 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,82 +1,88 @@ -# 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 - -# Local variable to store the local config file to use, if any. -local fixed_config="" - -# 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 - fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" -else - #use this when they don't have a ~/.tmux.conf - 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 "$@" ]] +# Only run if tmux is actually installed +if which tmux &> /dev/null then - \tmux $@ - # Try to connect to an existing session. - elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + # 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 - \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit - # Just run tmux, fixing the TERM variable if requested. + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else - \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi -} -# Use the completions for tmux for our function -compdef _tmux zsh_tmux_plugin_run + # Local variable to store the local config file to use, if any. + local fixed_config="" -# 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" ]] + # Set the correct local config file to use. + if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then - export ZSH_TMUX_AUTOSTARTED=true - zsh_tmux_plugin_run + #use this when they have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" + else + #use this when they don't have a ~/.tmux.conf + 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 '$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 '$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 From 20fe5e6a570fa5d9dfd246d020ecc2c18427405f Mon Sep 17 00:00:00 2001 From: RomainBelorgey Date: Fri, 1 Mar 2013 18:33:38 +0100 Subject: [PATCH 39/82] Update _capistrano Add use of Capfile commands --- plugins/capistrano/_capistrano | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano index cf6b50c7f..1002dad96 100644 --- a/plugins/capistrano/_capistrano +++ b/plugins/capistrano/_capistrano @@ -1,7 +1,7 @@ #compdef cap #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 echo "\nGenerating .cap_tasks~..." > /dev/stderr cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ From c2d42f5a90f12ca925702ed4e8fc5563baf8397c Mon Sep 17 00:00:00 2001 From: Michele Bologna Date: Tue, 5 Mar 2013 22:50:27 +0100 Subject: [PATCH 40/82] added michelebologna theme --- themes/michelebologna.zsh-theme | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 themes/michelebologna.zsh-theme diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme new file mode 100644 index 000000000..002d46287 --- /dev/null +++ b/themes/michelebologna.zsh-theme @@ -0,0 +1,43 @@ +# 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 +#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 [%@]' From 0b6e7358850f7fd74556289b1e0c1634896ed66b Mon Sep 17 00:00:00 2001 From: Michele Bologna Date: Tue, 5 Mar 2013 23:01:00 +0100 Subject: [PATCH 41/82] added comment for auto-generated hostname color --- themes/michelebologna.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme index 002d46287..ef4c6d740 100644 --- a/themes/michelebologna.zsh-theme +++ b/themes/michelebologna.zsh-theme @@ -16,6 +16,7 @@ RESET_COLOR="%{$reset_color%}" 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) From 49860bd61ff61d284f3b356bec0042cace98a686 Mon Sep 17 00:00:00 2001 From: ishtu Date: Sun, 10 Mar 2013 19:18:33 +0300 Subject: [PATCH 42/82] add function vncviwer --- plugins/osx/osx.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index f278d4f8d..51cd7c143 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -154,3 +154,6 @@ function trash() { IFS=$temp_ifs } +function vncviewer() { + open vnc://$@ +} From 6dd286bba3fe36278ca6de45567c3842e2db7cc0 Mon Sep 17 00:00:00 2001 From: Vladimir Zakharov Date: Mon, 11 Mar 2013 14:24:12 +0400 Subject: [PATCH 43/82] Mercurial: add aliases for 'incoming' and 'outgoing' commands --- plugins/mercurial/mercurial.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index a3a6ff8b6..820e1aee9 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -7,7 +7,9 @@ alias hgco='hg checkout' alias hgd='hg diff' alias hged='hg diffmerge' # pull and update +alias hgi='hg incoming' alias hgl='hg pull -u' +alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' # this is the 'git commit --amend' equivalent @@ -17,4 +19,4 @@ function hg_current_branch() { if [ -d .hg ]; then echo hg:$(hg branch) fi -} \ No newline at end of file +} From 72ec24108a88d79a13cc3581f17b440418048a72 Mon Sep 17 00:00:00 2001 From: bertag Date: Mon, 11 Mar 2013 13:41:32 -0600 Subject: [PATCH 44/82] Tweaked parse_git_dirty() in lib/git.zsh to support proper dirty/clean parsing against both git 1.6 and git 1.7+ --- lib/git.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..172bf4f7a 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -9,16 +9,19 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { 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 [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" - fi - if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + fi + 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" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi - fi + fi + fi } # get the difference between the local and remote branches From a66bc75ad7d01d1a223cb60cb73810e0c79d2e4e Mon Sep 17 00:00:00 2001 From: "y.s" Date: Tue, 12 Mar 2013 21:15:22 +0800 Subject: [PATCH 45/82] add: A new theme 'ys'. --- themes/ys.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/ys.zsh-theme diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme new file mode 100644 index 000000000..81f7e03fa --- /dev/null +++ b/themes/ys.zsh-theme @@ -0,0 +1,22 @@ +# Clean, simple, compatible and meaningful. +# Tested on Linux, Unix and Windows. +# It is recommanded to use with a dark background and the font Inconsolata. +# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. +# +# Oct 2012 ys + +function box_name { + [ -f ~/.box-name ] && cat ~/.box-name || hostname -s +} + +local current_dir='${PWD/#$HOME/~}' +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=" +# %{$fg[green]%}%n%{$reset_color%} %{$fg[white]%}at%{$reset_color%} %{$fg[cyan]%}$(box_name)%{$reset_color%} %{$fg[white]%}in%{$reset_color%} %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}${git_info} %{$fg[white]%}[%*]%{$reset_color%} +%{$fg[red]%}$ %{$reset_color%}" From 300f94cb0e1121e7796edbedcbc6d686e755be5b Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:11:18 -0400 Subject: [PATCH 46/82] Use [ -nt ] instead of stat -f%m to check cache files. --- plugins/ant/ant.plugin.zsh | 16 +++------------- plugins/cake/cake.plugin.zsh | 11 ++++------- plugins/gradle/gradle.plugin.zsh | 19 +++---------------- plugins/phing/phing.plugin.zsh | 9 +++------ 4 files changed, 13 insertions(+), 42 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 691d4d2db..45f2b06eb 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -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 () { - if [ ! -f .ant_targets ]; then return 0; - else - accurate=$($stat_cmd .ant_targets) - changed=$($stat_cmd build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .ant_targets ] && return 0; + [ .ant_targets -nt build.xml ] && return 0; + return 1; } _ant () { diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index 1d0d196ee..44cc47470 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () { return 1; fi - if [ ! -f ${_cake_task_cache_file} ]; then return 0; - else - accurate=$(stat -f%m $_cake_task_cache_file) - changed=$(stat -f%m Cakefile) - return $(expr $accurate '>=' $changed) - fi + [ ! -f ${_cake_task_cache_file} ] && return 0; + [ ${_cake_task_cache_file} -nt Cakefile ] && return 0; + return 1; } _cake () { @@ -33,4 +30,4 @@ _cake () { fi } -compdef _cake cake \ No newline at end of file +compdef _cake cake diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index fc4c78c50..9229512f7 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -54,27 +54,14 @@ function in_gradle() { 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 # timestamp has changed, and if so, regen # the .gradle_tasks cache file ############################################################################ _gradle_does_task_list_need_generating () { - if [ ! -f .gradletasknamecache ]; then return 0; - else - accurate=$($stat_cmd .gradletasknamecache) - changed=$($stat_cmd build.gradle) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .gradletasknamecache ] && return 0; + [ .gradletasknamecache -nt build.gradle ] && return 0; + return 1; } diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 8f4adca08..1abf0a954 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,10 +1,7 @@ _phing_does_target_list_need_generating () { - if [ ! -f .phing_targets ]; then return 0; - else - accurate=$(stat -f%m .phing_targets) - changed=$(stat -f%m build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .phing_targets ] && return 0; + [ .phing_targets -nt build.xml ] && return 0; + return 1; } _phing () { From bdf4f5a347789069dda438e64467344b551fff00 Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:15:05 -0400 Subject: [PATCH 47/82] Allow ":" and "-" characters in phing tasks. Tasks that included hyphens or colons were being excluded from completion. This improves the usage for this. --- plugins/phing/phing.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 1abf0a954..795f1db85 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -7,7 +7,7 @@ _phing_does_target_list_need_generating () { _phing () { if [ -f build.xml ]; 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 compadd `cat .phing_targets` fi From 4bf174c38b2b8ff9b000accf63155d9756c63a02 Mon Sep 17 00:00:00 2001 From: hacfi Date: Wed, 13 Mar 2013 04:06:16 +0100 Subject: [PATCH 48/82] Autocomplete composer default methods if composer.json is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This plugin currently doesn't autocomplete composer commands if there is no composer.json in the current dir. However, the commands create-project, init, search, selfupdate and show are still useful without a composer.json! --- plugins/composer/composer.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index c9b762d07..639677ba6 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -13,6 +13,8 @@ _composer_get_command_list () { _composer () { if [ -f composer.json ]; then compadd `_composer_get_command_list` + else + compadd create-project init search selfupdate show fi } @@ -26,4 +28,4 @@ alias ci='composer install' alias ccp='composer create-project' # install composer in the current directory -alias cget='curl -s https://getcomposer.org/installer | php' \ No newline at end of file +alias cget='curl -s https://getcomposer.org/installer | php' From 55c6fd5c38ad47c2dfa27e6e1a0913d2aa594172 Mon Sep 17 00:00:00 2001 From: "y.s" Date: Wed, 13 Mar 2013 15:55:35 +0800 Subject: [PATCH 49/82] opt: Optimize the color scheme. Add some basic comments. --- themes/ys.zsh-theme | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 81f7e03fa..3d316390e 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -1,22 +1,34 @@ # Clean, simple, compatible and meaningful. -# Tested on Linux, Unix and Windows. -# It is recommanded to use with a dark background and the font Inconsolata. +# 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. -# -# Oct 2012 ys +# +# 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/~}' -local git_info='$(git_prompt_info)' +# 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=" -# %{$fg[green]%}%n%{$reset_color%} %{$fg[white]%}at%{$reset_color%} %{$fg[cyan]%}$(box_name)%{$reset_color%} %{$fg[white]%}in%{$reset_color%} %{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}${git_info} %{$fg[white]%}[%*]%{$reset_color%} -%{$fg[red]%}$ %{$reset_color%}" +%{$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%}" From 7903f5185622b3ead5608f170b5457121bda413a Mon Sep 17 00:00:00 2001 From: Max Riveiro Date: Wed, 13 Mar 2013 12:36:48 +0400 Subject: [PATCH 50/82] Fix git dirty status in dallas.zsh-theme --- themes/dallas.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index e9b4f852a..c9e335521 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -14,7 +14,7 @@ fi DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" # Grab the current filepath, use shortcuts: ~/Desktop # 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 DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" # Use a % for normal users and a # for privelaged (root) users. From 6c6072c492064abf613fc1b89b4d635020631ef4 Mon Sep 17 00:00:00 2001 From: Ashley Snowdon Date: Wed, 13 Mar 2013 11:21:43 +0000 Subject: [PATCH 51/82] Modified to use full parameter as newer versions of base64 uses lowercase D --- plugins/encode64/encode64.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh index 3b59447c5..4dbd1b453 100644 --- a/plugins/encode64/encode64.plugin.zsh +++ b/plugins/encode64/encode64.plugin.zsh @@ -1,4 +1,4 @@ encode64(){ echo -n $1 | base64 } -decode64(){ echo -n $1 | base64 -D } +decode64(){ echo -n $1 | base64 --decode } alias e64=encode64 alias d64=decode64 From 56e835426bc895a191540d4d640b7750a81ff23a Mon Sep 17 00:00:00 2001 From: Philip Stark Date: Thu, 14 Mar 2013 00:31:14 +0100 Subject: [PATCH 52/82] fix git_prompt_status() to not say the repository has untracked files all the time --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..5cbd819f8 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -62,7 +62,7 @@ function git_prompt_long_sha() { git_prompt_status() { INDEX=$(git status --porcelain -b 2> /dev/null) STATUS="" - if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + if $(echo "$INDEX" | grep '^\?\? ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" fi if $(echo "$INDEX" | grep '^A ' &> /dev/null); then From 1cfd813f796e4472575daf4b51cd816bacc833e0 Mon Sep 17 00:00:00 2001 From: rylwin Date: Wed, 13 Mar 2013 22:48:28 -0500 Subject: [PATCH 53/82] last-working-dir: Use >! to overwrite $cache_file Use ">!" to overwrite $cache_file in case noclobber is set. When noclobber is set, zsh will not allow the use of ">" to overwrite the contents of a file. Instead, it displays a "file exists" error. By using ">!" instead, we tell zsh to overwrite the file without complaining. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index 190bc279d..4903616e3 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - echo "$PWD" > "$cache_file" + # Use >! in case noclobber is set to avoid "file exists" error + echo "$PWD" >! "$cache_file" } # Changes directory to the last working directory. From 4c8bba57acb0f64edde89321d5d6cbc3a5226cac Mon Sep 17 00:00:00 2001 From: Ryan Winograd Date: Wed, 13 Mar 2013 22:51:12 -0500 Subject: [PATCH 54/82] Fix whitespace That's what I get for using GitHub text editor and not checking tabs. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index 4903616e3..ccf0f5b22 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,7 +9,7 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - # Use >! in case noclobber is set to avoid "file exists" error + # Use >! in case noclobber is set to avoid "file exists" error echo "$PWD" >! "$cache_file" } From 3826c7bf85b0005438c872fedc7aa1b4174e82c9 Mon Sep 17 00:00:00 2001 From: Flavius Aspra Date: Fri, 15 Mar 2013 22:07:47 +0100 Subject: [PATCH 55/82] allow setting a custom HISTFILE before oh-my-zsh is loaded --- lib/history.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/history.zsh b/lib/history.zsh index 876936b87..655945166 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -1,5 +1,7 @@ ## Command history configuration -HISTFILE=$HOME/.zsh_history +if [ -z $HISTFILE ]; then + HISTFILE=$HOME/.zsh_history +fi HISTSIZE=10000 SAVEHIST=10000 From 2a1c9ff340401ca63efd846ed626903d72771c25 Mon Sep 17 00:00:00 2001 From: Marcel Wolf Date: Sat, 16 Mar 2013 00:06:46 -0400 Subject: [PATCH 56/82] add ssh-agent option to set default lifetime of identities By default, ssh-agent stores identities forever. It has an option to set a maximum lifetime for identites (useful to expire passphrase protected keys). Allow this option to be set using: zstyle :omz:plugins:ssh-agent lifetime