Commit 2595484a authored by Sébastien M-B's avatar Sébastien M-B
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	lib/aliases.zsh
parents 8d23a361 6e6cf430
#compdef rvm
local curcontext="$curcontext" state line cmds ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \
'-e[Execute code from the command line]:code' \
'(-G)-G[root gem path to use]:path:_files' \
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \
'(--head)--head[with update, updates rvm to git head version]' \
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \
'(--default)--default[with ruby select, sets a default ruby for new shells]' \
'(--debug)--debug[Toggle debug mode on for very verbose output]' \
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \
'(--force)--force[Force install, removes old install & source before install]' \
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \
'(--docs)--docs[with install, attempt to generate ri after installation]' \
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
cmds)
cmds=(
"version:show the rvm version installed in rvm_path"
"use:setup current shell to use a specific ruby version"
"reload:reload rvm source itself (useful after changing rvm source)"
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)."
"update:upgrades rvm to the latest version."
"reset:remove current and stored default & system settings."
"info :show the *current* environment information for current ruby"
"current:print the *current* ruby version and the name of any gemset being used."
"debug:show info plus additional information for common issues"
"install:install one or many ruby versions"
"uninstall:uninstall one or many ruby versions, leaves their sources"
"remove:uninstall one or many ruby versions and remove their sources"
"migrate:Lets you migrate all gemsets from one ruby to another."
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically."
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like."
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm."
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)."
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner."
"disk-usage:Tells you how much disk space rvm install is using."
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm."
"docs:Tools to make installing ri and rdoc documentation easier."
"rvmrc:Tools related to managing rvmrc trust and loading."
"exec:runs an arbitrary command as a set operation."
"ruby:runs a named ruby file against specified and/or all rubies"
"gem:runs a gem command using selected ruby's 'gem'"
"rake:runs a rake task against specified and/or all rubies"
"tests:runs 'rake test' across selected ruby versions"
"specs:runs 'rake spec' across selected ruby versions"
"monitor:Monitor cwd for testing, run rake {spec,test} on changes."
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/"
"rubygems:Switches the installed version of rubygems for the current ruby."
"gemdir:display the path to the current gem directory (GEM_HOME)."
"srcdir:display the path to rvm source directory (may be yanked)"
"fetch:Performs an archive / src fetch only of the selected ruby."
"list:show currently installed rubies, interactive output."
"package:Install a dependency package {readline,iconv,zlib,openssl}"
"notes:Display notes, with operating system specifics."
"export:Temporarily set an environment variable in the current shell."
"unexport:Undo changes made to the environment by 'rvm export'."
)
_describe -t commands 'rvm command' cmds && ret=0
;;
args)
case $line[1] in
(use|uninstall|remove|list)
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0
;;
(install|fetch)
_values -S , 'rubies' $(rvm list known_strings) && ret=0
;;
gemset)
if (( CURRENT == 3 )); then
_values 'gemset_commands' \
'import' \
'export' \
'create' \
'copy' \
'rename' \
'empty' \
'delete' \
'name' \
'dir' \
'list' \
'list_all' \
'gemdir' \
'install' \
'pristine' \
'clear' \
'use' \
'update' \
'unpack' \
'globalcache'
else
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null)
fi
ret=0
;;
package)
if (( CURRENT == 3 )); then
_values 'package_commands' \
'install' \
'uninstall'
else
_values 'packages' \
'readline' \
'iconv' \
'curl' \
'openssl' \
'zlib' \
'autoconf' \
'ncurses' \
'pkgconfig' \
'gettext' \
'glib' \
'mono' \
'llvm' \
'libxml2' \
'libxslt' \
'libyaml'
fi
ret=0
;;
*)
(( ret )) && _message 'no more arguments'
;;
esac
;;
esac
return ret
fpath=($rvm_path/scripts/zsh/Completion $fpath)
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7-p334'
local ruby19='ruby-1.9.2-p180'
local ruby19='ruby-1.9.3-p194'
function rb18 {
if [ -z "$1" ]; then
......@@ -42,3 +44,8 @@ function gems {
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}
function _rvm_completion {
source $rvm_path"/scripts/zsh/Completion/_rvm"
}
compdef _rvm_completion rvm
# if using GNU screen, let the zsh tell screen what the title and hardstatus
# of the tab window should be.
if [[ $TERM == "screen" ]]; then
if [[ "$TERM" == screen* ]]; then
if [[ $_GET_PATH == '' ]]; then
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"'
fi
......
......@@ -57,8 +57,6 @@ sprunge() {
fi
else
echo Using input from a pipe or STDIN redirection... >&2
while read -r line ; do
echo $line
done | curl -F 'sprunge=<-' http://sprunge.us
curl -F 'sprunge=<-' http://sprunge.us
fi
}
# Sublime Text 2 Aliases
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
#unamestr = 'uname'
local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
if [[ $('uname') == 'Linux' ]]; then
if [ -f '/usr/bin/sublime_text' ]; then
st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
else
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
fi
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
fi
alias stt='st .'
#compdef supervisorctl
typeset -A opt_args
local context state line
_supervisorctl() {
_arguments -s -S \
{--configuration,-c}"[configuration file path (default /etc/supervisor.conf)]:FILENAME:_files" \
{--help,-h}"[print usage message and exit]:" \
{--interactive,-i}"[start an interactive shell after executing commands]" \
{--serverurl,-s}"[URL on which supervisord server is listening (default "http://localhost:9001").]" \
{--username,-u}"[username to use for authentication with server]:USERNAME:_users" \
{--password,-p}"[password to use for authentication with server]:PASSWORD:" \
{--history-file,-r}"[keep a readline history (if readline is available)]:FILENAME:_files" \
"*::supervisorctl commands:_supervisorctl_command"
}
(( $+functions[_supervisorctl_command] )) ||
_supervisorctl_command() {
local cmd ret=1
(( $+supervisorctl_cmds )) || _supervisorctl_cmds=(
"add:Activates any updates in config for process/group" \
"avail:Display all configured processes" \
"clear:Clear process/multiple-process/all-process log files" \
"exit:Exit the supervisor shell." \
"fg:Connect to a process in foreground mode" \
"maintail:tail of supervisor main log file" \
"open:Connect to a remote supervisord process. (for UNIX domain socket, use unix:///socket/path)" \
"pid:Get the PID of supervisord." \
"quit:Exit the supervisor shell." \
"reload:Restart the remote supervisord." \
"remove:Removes process/group from active config" \
"reread:Reload the daemon's configuration files" \
"restart:Restart process or group." \
"shutdown:Shut the remote supervisord down." \
"start:Start process or groups." \
"status:Get process status info." \
"stop:Stop process or group." \
"tail:tail of process stdout" \
"update:Reload config and add/remove as necessary" \
"version:Show the version of the remote supervisord process" \
"help:Show help" \
)
if (( CURRENT == 1 )); then
_describe -t commands 'supervisorctl subcommand' _supervisorctl_cmds \
|| compadd "$@" - ${(s.:.)${(j.:.)_supervisorctl_syns}}
else
local curcontext="$curcontext"
cmd="${${_supervisorctl_cmds[(r)$words[1]:*]%%:*}:-${(k)_supervisorctl_syns[(r)(*:|)$words[1](:*|)]}}"
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:supervisorctl-${cmd}:"
_call_function ret _supervisorctl_$cmd || _message 'no more arguments'
else
_message "unknown supervisorctl command: $words[1]"
fi
return ret
fi
}
# get supervisor contoroll processes
(( $+functions[_get_supervisor_procs] )) ||
_get_supervisor_procs() {
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
if [[ -z "$cache_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy _supervisor_procs_caching_policy
fi
if ( [[ ${+_supervisor_procs} -eq 0 ]] || _cache_invalid supervisor_procs ) \
&& ! _retrieve_cache supervisor_procs; then
_supervisor_procs=(${${(f)"$(supervisorctl status >/dev/null 2>&1 | awk -F' ' '{print $1}')"}})
_store_cache supervisor_procs _supervisor_procs
fi
local expl
_wanted supervisor_procs expl 'supervisor processes' compadd -a _supervisor_procs
}
_supervisor_procs_caching_policy() {
local -a oldp
oldp=( "$1"(Nmw+1) )
(( $#oldp ))
}
(( $+functions[_supervisorctl_add] )) ||
_supervisorctl_add() {
_arguments -s \
"--help[use help system]" \
"*::supervisorctl commands:_supervisorctl"
}
(( $+functions[_supervisorctl_help] )) ||
_supervisorctl_help() {
_arguments -s \
"*:supervisorctl commands:_supervisorctl"
}
(( $+functions[_supervisorctl_maintail] )) ||
_supervisorctl_maintail() {
_arguments -s \
'-f[Continuous tail of supervisor main log file (Ctrl-C to exit)]'
}
(( $+functions[_supervisorctl_start] )) ||
_supervisorctl_start() {
# TODO: add 'all'
_arguments -s \
'*::supvervisor process:_get_supervisor_procs'
}
(( $+functions[_supervisorctl_status] )) ||
_supervisorctl_status() {
_arguments \
'*::supvervisor process:_get_supervisor_procs'
}
(( $+functions[_supervisorctl_stop] )) ||
_supervisorctl_stop() {
# TODO: add 'all'
_arguments -s \
'*::supvervisor process:_get_supervisor_procs'
}
(( $+functions[_supervisorctl_tail] )) ||
_supervisorctl_tail() {
# TODO: add 'stderr'
_arguments -s \
'-f[Continuous tail of named process stdout Ctrl-C to exit.]' \
'*::supvervisor process:_get_supervisor_procs'
}
_supervisorctl "$@"
#compdef supervisord
typeset -A opt_args
local context state line
_arguments \
{--configuration,-c}"[configuration file]:FILENAME:_files" \
{--nodaemon,-n}"[run in the foreground (same as 'nodaemon true' in config file)]" \
{--help,-h}"[print this usage message and exit]:" \
{--user,-u}"[run supervisord as this user]:USER:_users" \
{--umask,-m}"[use this umask for daemon subprocess (default is 022)]" \
{--directory,-d}"[directory to chdir to when daemonized]" \
{--logfile,-l}"[use FILENAME as logfile path]:FILENAME:_files" \
{--logfile_maxbytes,-y}"[use BYTES to limit the max size of logfile]" \
{--logfile_backups,-z}"[number of backups to keep when max bytes reached]" \
{--loglevel,-e}"[use LEVEL as log level (debug,info,warn,error,critical)]:level:->levels" \
{--pidfile,-j}"[write a pid file for the daemon process to FILENAME]:FILENAME:_files" \
{--identifier,-i}"[identifier used for this instance of supervisord]" \
{--childlogdir,-q}"[the log directory for child process logs]:child log directory:_files -/" \
{--nocleanup,-k}"[prevent the process from performing cleanup (removal of old automatic child log files) at startup.]" \
{--minfds,-a}"[the minimum number of file descriptors for start success]" \
{--strip_ansi,-t}"[strip ansi escape codes from process output]" \
"--minprocs[the minimum number of processes available for start success]" \
"--profile_options[run supervisord under profiler and output results based on OPTIONS, which is a comma-sep'd list of 'cumulative', 'calls', and/or 'callers', e.g. 'cumulative,callers')]" \
"*::args:_gnu_generic"
case $state in
levels)
levels=("debug" "info" "warn" "error" "critical")
_describe -t levels 'supervisord levels' levels && return 0
;;
esac
# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor.
function svn_prompt_info {
if [ $(in_svn) ]; then
if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then
unset SVN_SHOW_BRANCH
_DISPLAY=$(svn_get_branch_name)
else
_DISPLAY=$(svn_get_repo_name)
fi
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
unset _DISPLAY
fi
}
......@@ -15,11 +23,21 @@ function in_svn() {
function svn_get_repo_name {
if [ $(in_svn) ]; then
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
fi
}
function svn_get_branch_name {
_DISPLAY=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }')
if [ "x$_DISPLAY" = "x" ]; then
svn_get_repo_name
else
echo $_DISPLAY
fi
unset _DISPLAY
}
function svn_get_rev_nr {
if [ $(in_svn) ]; then
svn info 2> /dev/null | sed -n s/Revision:\ //p
......@@ -28,10 +46,12 @@ function svn_get_rev_nr {
function svn_dirty_choose {
if [ $(in_svn) ]; then
s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null)
if [ $s ]; then
svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
if [ $pipestatus[-1] -eq 0 ]; then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
else
# Otherwise, no lines were found, or an error occurred. Return clean.
echo $2
fi
fi
......
# symfony basic command completion
_symfony_get_command_list () {
./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }'
}
_symfony () {
if [ -f symfony ]; then
compadd `_symfony_get_command_list`
fi
}
compdef _symfony symfony
......@@ -10,4 +10,10 @@ _symfony2 () {
fi
}
compdef _symfony2 app/console
\ No newline at end of file
compdef _symfony2 app/console
compdef _symfony2 sf
#Alias
alias sf2='php app/console'
alias sf2clear='php app/console cache:clear'
user_commands=(
list-units is-active status show help list-unit-files
is-enabled list-jobs show-environment)
sudo_commands=(
start stop reload restart try-restart isolate kill
reset-failed enable disable reenable preset mask unmask
link load cancel set-environment unset-environment)
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
# Set Apple Terminal.app resume directory
# based on this answer: http://superuser.com/a/315029
# 2012-10-26: (javageek) Changed code using the updated answer
function chpwd {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
# Tell the terminal about the working directory whenever it changes.
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL, including
# the host name to disambiguate local vs. remote paths.
chpwd
\ No newline at end of file
# Percent-encode the pathname.
local URL_PATH=''
{
# Use LANG=C to process text byte-by-byte.
local i ch hexch LANG=C
for ((i = 1; i <= ${#PWD}; ++i)); do
ch="$PWD[i]"
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
URL_PATH+="$ch"
else
hexch=$(printf "%02X" "'$ch")
URL_PATH+="%$hexch"
fi
done
}
local PWD_URL="file://$HOST$URL_PATH"
#echo "$PWD_URL" # testing
printf '\e]7;%s\a' "$PWD_URL"
}
# Register the function so it is called whenever the working
# directory changes.
autoload add-zsh-hook
add-zsh-hook chpwd update_terminal_cwd
# Tell the terminal about the initial directory.
update_terminal_cwd
fi
#compdef theme
_arguments "1: :($(lstheme | tr "\n" " "))"
function theme
{
if [ "$1" = "random" ]; then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ]
then
source "$ZSH_CUSTOM/$1.zsh-theme"
else
source "$ZSH/themes/$1.zsh-theme"
fi
fi
}
function lstheme
{
cd $ZSH/themes
ls *zsh-theme | sed 's,\.zsh-theme$,,'
}
# URL Tools
# Adds handy command line aliases useful for dealing with URLs
#
# Taken from:
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
URLTOOLS_METHOD=""
fi
if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then
alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then
alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"'
alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"'
elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then
if perl -MURI::Encode -e 1&> /dev/null; then
alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"'
alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"'
elif perl -MURI::Escape -e 1 &> /dev/null; then
alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"'
alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"'
else
alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'"
alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'"
fi
fi
unset URLTOOLS_METHOD
\ No newline at end of file
......@@ -46,6 +46,11 @@ __box_list ()
_wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
}
__vm_list ()
{
_wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2)
}
__vagrant-box ()
{
local curcontext="$curcontext" state line
......@@ -99,6 +104,8 @@ case $state in
(box)
__vagrant-box
;;
(up|provision|package|destroy|reload|ssh|halt|resume|status)
_arguments ':feature:__vm_list'
esac
;;
esac
function zle-line-init zle-keymap-select {
# Ensures that $terminfo values are valid and updates editor information when
# the keymap changes.
function zle-keymap-select zle-line-init zle-line-finish {
# The terminal must be in application mode when ZLE is active for $terminfo
# values to be valid.
if (( ${+terminfo[smkx]} )); then
printf '%s' ${terminfo[smkx]}
fi
if (( ${+terminfo[rmkx]} )); then
printf '%s' ${terminfo[rmkx]}
fi
zle reset-prompt
zle -R
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
bindkey -v
......
WRAPPER_FOUND=0
for wrapsource in "/usr/local/bin/virtualenvwrapper.sh" "/etc/bash_completion.d/virtualenvwrapper" ; do
if [[ -e $wrapsource ]] ; then
WRAPPER_FOUND=1
source $wrapsource
wrapsource=`which virtualenvwrapper_lazy.sh`
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
# Automatically activate Git projects' virtual environments based on the
# directory name of the project. Virtual environment name can be overridden
# by placing a .venv file in the project root with a virtualenv name in it
function workon_cwd {
# Check that this is a Git repo
PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
if (( $? == 0 )); then
# Check for virtualenv name override
ENV_NAME=`basename "$PROJECT_ROOT"`
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
fi
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
fi
elif [ $CD_VIRTUAL_ENV ]; then
# We've just left the repo, deactivate the environment
# Note: this only happens if the virtualenv was activated automatically
deactivate && unset CD_VIRTUAL_ENV
fi
unset PROJECT_ROOT
}
if [[ -f "$wrapsource" ]]; then
source $wrapsource
# New cd function that does the virtualenv magic
function cd {
builtin cd "$@" && workon_cwd
}
fi
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
# Automatically activate Git projects' virtual environments based on the
# directory name of the project. Virtual environment name can be overridden
# by placing a .venv file in the project root with a virtualenv name in it
function workon_cwd {
# Check that this is a Git repo
PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
if (( $? == 0 )); then
# Check for virtualenv name override
ENV_NAME=`basename "$PROJECT_ROOT"`
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
fi
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
fi
elif [ $CD_VIRTUAL_ENV ]; then
# We've just left the repo, deactivate the environment
# Note: this only happens if the virtualenv was activated automatically
deactivate && unset CD_VIRTUAL_ENV
fi
unset PROJECT_ROOT
}
break
# New cd function that does the virtualenv magic
function cd {
builtin cd "$@" && workon_cwd
}
fi
done
if [ $WRAPPER_FOUND -eq 0 ] ; then
print "zsh virtualenvwrapper plugin: Couldn't activate virtualenvwrapper. Please run \`pip install virtualenvwrapper\`."
else
print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
fi
## zeus
**Maintainer:** [b4mboo](https://github.com/b4mboo)
* `zi` aliases `zeus init`
* `zinit` aliases `zeus init`
* `zs` aliases `zeus start`
* `ztart` aliases `zeus start`
* `zc` aliases `zeus console`
* `zonsole` aliases `zeus console`
* `zsr` aliases `zeus server`
* `zerver` aliases `zeus server`
* `zr` aliases `zeus rake`
* `zake` aliases `zeus rake`
* `zg` aliases `zeus generate`
* `zenerate` aliases `zeus generate`
* `zrn` aliases `zeus runner`
* `zunner` aliases `zeus runner`
* `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber`
* `zspec` aliases `zeus rspec`
* `zt` aliases `zeus test`
* `zest` aliases `zeus test`
* `zu` aliases `zeus test test/unit/*`
* `zunits` aliases `zeus test test/unit/*`
* `zf` aliases `zeus test test/functional/*`
* `zunctional` aliases `zeus test test/functional/*`
* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
* `zsw` aliases `rm .zeus.sock`
* `zweep` aliases `rm .zeus.sock`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment