summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/aliases.zsh35
-rw-r--r--lib/directories.zsh37
-rw-r--r--lib/history.zsh9
-rw-r--r--lib/key-bindings.zsh3
-rw-r--r--lib/misc.zsh15
-rw-r--r--lib/termsupport.zsh52
-rw-r--r--lib/theme-and-appearance.zsh8
-rw-r--r--plugins/ant/ant.plugin.zsh6
-rw-r--r--plugins/autoenv/autoenv.plugin.zsh11
-rw-r--r--plugins/cake/cake.plugin.zsh2
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh16
-rw-r--r--plugins/common-aliases/common-aliases.plugin.zsh6
-rw-r--r--plugins/composer/composer.plugin.zsh29
-rw-r--r--plugins/dircycle/dircycle.plugin.zsh41
-rw-r--r--plugins/docker/_docker9
-rw-r--r--plugins/git-prompt/git-prompt.plugin.zsh3
-rw-r--r--plugins/jhbuild/README.md4
-rw-r--r--plugins/jhbuild/jhbuild.plugin.zsh28
-rw-r--r--plugins/jump/jump.plugin.zsh1
-rw-r--r--plugins/laravel4/laravel4.plugin.zsh2
-rw-r--r--plugins/laravel5/laravel5.plugin.zsh20
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh2
-rw-r--r--plugins/sudo/sudo.plugin.zsh5
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh8
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh113
-rw-r--r--plugins/web-search/web-search.plugin.zsh61
-rw-r--r--themes/adben.zsh-theme15
-rw-r--r--themes/apple.zsh-theme1
-rw-r--r--themes/gnzh.zsh-theme3
-rw-r--r--themes/half-life.zsh-theme2
-rw-r--r--themes/jonathan.zsh-theme5
-rw-r--r--themes/kolo.zsh-theme2
-rw-r--r--themes/linuxonly.zsh-theme1
-rw-r--r--themes/mikeh.zsh-theme2
-rw-r--r--themes/rkj-repos.zsh-theme12
-rw-r--r--themes/simonoff.zsh-theme5
-rw-r--r--themes/steeef.zsh-theme2
-rw-r--r--themes/zhann.zsh-theme2
-rwxr-xr-xtools/install.sh4
39 files changed, 336 insertions, 246 deletions
diff --git a/lib/aliases.zsh b/lib/aliases.zsh
deleted file mode 100644
index aae865046..000000000
--- a/lib/aliases.zsh
+++ /dev/null
@@ -1,35 +0,0 @@
-# Push and pop directories on directory stack
-alias pu='pushd'
-alias po='popd'
-
-# Basic directory operations
-alias ...='cd ../..'
-alias -- -='cd -'
-
-# Super user
-alias _='sudo'
-alias please='sudo'
-
-#alias g='grep -in'
-
-# Show history
-if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
-then
- alias history='fc -fl 1'
-elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
-then
- alias history='fc -El 1'
-elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
-then
- alias history='fc -il 1'
-else
- alias history='fc -l 1'
-fi
-# List direcory contents
-alias lsa='ls -lah'
-alias l='ls -lah'
-alias ll='ls -lh'
-alias la='ls -lAh'
-
-alias afind='ack-grep -il'
-
diff --git a/lib/directories.zsh b/lib/directories.zsh
index 02743e0c7..3bffa9fd9 100644
--- a/lib/directories.zsh
+++ b/lib/directories.zsh
@@ -3,12 +3,10 @@ setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
-alias ..='cd ..'
-alias cd..='cd ..'
-alias cd...='cd ../..'
-alias cd....='cd ../../..'
-alias cd.....='cd ../../../..'
-alias cd/='cd /'
+alias -g ...='../..'
+alias -g ....='../../..'
+alias -g .....='../../../..'
+alias -g ......='../../../../..'
alias 1='cd -'
alias 2='cd -2'
@@ -20,23 +18,16 @@ alias 7='cd -7'
alias 8='cd -8'
alias 9='cd -9'
-cd () {
- if [[ "x$*" == "x..." ]]; then
- cd ../..
- elif [[ "x$*" == "x...." ]]; then
- cd ../../..
- elif [[ "x$*" == "x....." ]]; then
- cd ../../../..
- elif [[ "x$*" == "x......" ]]; then
- cd ../../../../..
- elif [ -d ~/.autoenv ]; then
- source ~/.autoenv/activate.sh
- autoenv_cd "$@"
- else
- builtin cd "$@"
- fi
-}
-
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v | head -10'
+
+# List directory contents
+alias lsa='ls -lah'
+alias l='ls -lah'
+alias ll='ls -lh'
+alias la='ls -lAh'
+
+# Push and pop directories on directory stack
+alias pu='pushd'
+alias po='popd'
diff --git a/lib/history.zsh b/lib/history.zsh
index e78a98e9e..5de71c2d3 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -6,6 +6,15 @@ fi
HISTSIZE=10000
SAVEHIST=10000
+# Show history
+case $HIST_STAMPS in
+ "mm/dd/yyyy") alias history='fc -fl 1' ;;
+ "dd.mm.yyyy") alias history='fc -El 1' ;;
+ "yyyy-mm-dd") alias history='fc -il 1' ;;
+ *) alias history='fc -l 1' ;;
+esac
+
+setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
index 9063c6a18..eb2b58058 100644
--- a/lib/key-bindings.zsh
+++ b/lib/key-bindings.zsh
@@ -64,6 +64,9 @@ autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line
+# file rename magick
+bindkey "^[m" copy-prev-shell-word
+
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
diff --git a/lib/misc.zsh b/lib/misc.zsh
index a8678b8ec..0b7cb2696 100644
--- a/lib/misc.zsh
+++ b/lib/misc.zsh
@@ -2,9 +2,6 @@
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
-## file rename magick
-bindkey "^[m" copy-prev-shell-word
-
## jobs
setopt long_list_jobs
@@ -12,4 +9,14 @@ setopt long_list_jobs
export PAGER="less"
export LESS="-R"
-export LC_CTYPE=$LANG
+## super user alias
+alias _='sudo'
+alias please='sudo'
+
+## more intelligent acking for ubuntu users
+alias afind='ack-grep -il'
+
+# only define LC_CTYPE if undefined
+if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
+ export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
+fi
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index d9f2b64d4..e1c2e2f93 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -1,13 +1,21 @@
-#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
-#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
-#Fully support screen, iterm, and probably most modern xterm and rxvt
+# Set terminal window and tab/icon title
+#
+# usage: title short_tab_title [long_window_title]
+#
+# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
+# Fully supports screen, iterm, and probably most modern xterm and rxvt
+# (In screen, only short_tab_title is used)
+# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title {
- if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
- return
- fi
+ [[ "$EMACS" == *term* ]] && return
+
+ # if $2 is unset use $1 as default
+ # if it is set and empty, leave it as is
+ : ${2=$1}
+
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
- elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
+ elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name
fi
@@ -16,13 +24,21 @@ function title {
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
-#Appears when you have the prompt
+# Runs before showing the prompt
function omz_termsupport_precmd {
+ if [[ $DISABLE_AUTO_TITLE == true ]]; then
+ return
+ fi
+
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
-#Appears at the beginning of (and during) of command execution
+# Runs before executing the command
function omz_termsupport_preexec {
+ if [[ $DISABLE_AUTO_TITLE == true ]]; then
+ return
+ fi
+
emulate -L zsh
setopt extended_glob
@@ -33,18 +49,18 @@ function omz_termsupport_preexec {
title '$CMD' '%100>...>$LINE%<<'
}
-#Appears each time pwd is changed
-function omz_termsupport_chpwd {
- #Notify Terminal.app of current directory using undocumented OSC sequence
- #found in OS X 10.10's /etc/bashrc
+precmd_functions+=(omz_termsupport_precmd)
+preexec_functions+=(omz_termsupport_preexec)
+
+
+# Runs before showing the prompt, to update the current directory in Terminal.app
+function omz_termsupport_cwd {
+ # Notify Terminal.app of current directory using undocumented OSC sequence
+ # found in OS X 10.9 and 10.10's /etc/bashrc
if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
local PWD_URL="file://$HOSTNAME${PWD// /%20}"
printf '\e]7;%s\a' "$PWD_URL"
fi
}
-#Fire it once so the pwd is set properly upon shell startup
-omz_termsupport_chpwd
-precmd_functions+=(omz_termsupport_precmd)
-preexec_functions+=(omz_termsupport_preexec)
-chpwd_functions+=(omz_termsupport_chpwd)
+precmd_functions+=(omz_termsupport_cwd)
diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index 0353f9db4..926303ca4 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -1,14 +1,13 @@
# ls colors
-autoload colors; colors;
+autoload -U colors && colors
export LSCOLORS="Gxfxcxdxbxegedabagacad"
-#export LS_COLORS
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
if [[ "$(uname -s)" == "NetBSD" ]]; then
- # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
+ # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
@@ -23,7 +22,7 @@ fi
#setopt no_beep
setopt auto_cd
setopt multios
-setopt cdablevarS
+setopt cdablevars
if [[ x$WINDOW != x ]]
then
@@ -43,4 +42,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c
# Setup the prompt with pretty colors
setopt prompt_subst
-
diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh
index 45f2b06eb..0b738c94f 100644
--- a/plugins/ant/ant.plugin.zsh
+++ b/plugins/ant/ant.plugin.zsh
@@ -1,15 +1,15 @@
_ant_does_target_list_need_generating () {
[ ! -f .ant_targets ] && return 0;
- [ .ant_targets -nt build.xml ] && return 0;
+ [ build.xml -nt .ant_targets ] && return 0;
return 1;
}
_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
- sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets
+ ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
fi
- compadd `cat .ant_targets`
+ compadd -- `cat .ant_targets`
fi
}
diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
index ca5666979..a8271849e 100644
--- a/plugins/autoenv/autoenv.plugin.zsh
+++ b/plugins/autoenv/autoenv.plugin.zsh
@@ -1,6 +1,17 @@
+# Activates autoenv or reports its failure
+if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
+ echo '-------- AUTOENV ---------'
+ echo 'Could not find ~/.autoenv/activate.sh.'
+ echo 'Please check if autoenv is correctly installed.'
+ echo 'In the meantime the autoenv plugin is DISABLED.'
+ echo '--------------------------'
+ return 1
+fi
+
# The use_env call below is a reusable command to activate/create a new Python
# virtualenv, requiring only a single declarative line of code in your .env files.
# It only performs an action if the requested virtualenv is not the current one.
+
use_env() {
typeset venv
venv="$1"
diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh
index 44cc47470..2370df949 100644
--- a/plugins/cake/cake.plugin.zsh
+++ b/plugins/cake/cake.plugin.zsh
@@ -15,7 +15,7 @@ _cake_does_target_list_need_generating () {
fi
[ ! -f ${_cake_task_cache_file} ] && return 0;
- [ ${_cake_task_cache_file} -nt Cakefile ] && return 0;
+ [ Cakefile -nt ${_cake_task_cache_file} ] && return 0;
return 1;
}
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index f3d7ec2df..797554a13 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -7,3 +7,19 @@
# Arch Linux command-not-found support, you must have package pkgfile installed
# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
+
+# Fedora command-not-found support
+if [ -f /usr/libexec/pk-command-not-found ]; then
+ command_not_found_handler () {
+ runcnf=1
+ retval=127
+ [ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
+ [ ! -x /usr/libexec/packagekitd ] && runcnf=0
+ if [ $runcnf -eq 1 ]
+ then
+ /usr/libexec/pk-command-not-found $@
+ retval=$?
+ fi
+ return $retval
+ }
+fi
diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
index 90d59910c..e3830adcf 100644
--- a/plugins/common-aliases/common-aliases.plugin.zsh
+++ b/plugins/common-aliases/common-aliases.plugin.zsh
@@ -20,12 +20,6 @@ alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
alias t='tail -f'
-# because typing 'cd' is A LOT of work!!
-alias ..='cd ../'
-alias ...='cd ../../'
-alias ....='cd ../../../'
-alias .....='cd ../../../../'
-
# Command line head / tail shortcuts
alias -g H='| head'
alias -g T='| tail'
diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh
index 86f2ca4df..86f5be3d0 100644
--- a/plugins/composer/composer.plugin.zsh
+++ b/plugins/composer/composer.plugin.zsh
@@ -7,11 +7,11 @@
# Composer basic command completion
_composer_get_command_list () {
- composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
+ $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
}
_composer_get_required_list () {
- composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
+ $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
}
_composer () {
@@ -20,29 +20,30 @@ _composer () {
_arguments \
'1: :->command'\
'*: :->args'
- if [ -f composer.json ]; then
- case $state in
- command)
- compadd `_composer_get_command_list`
- ;;
- *)
- compadd `_composer_get_required_list`
- ;;
- esac
- else
- compadd create-project init search selfupdate show
- fi
+
+ case $state in
+ command)
+ compadd $(_composer_get_command_list)
+ ;;
+ *)
+ compadd $(_composer_get_required_list)
+ ;;
+ esac
}
compdef _composer composer
+compdef _composer composer.phar
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
+alias cr='composer require'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
+alias cgu='composer global update'
+alias cgr='composer global require'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
index c6b6ba785..1e31105b1 100644
--- a/plugins/dircycle/dircycle.plugin.zsh
+++ b/plugins/dircycle/dircycle.plugin.zsh
@@ -1,10 +1,37 @@
-##
-# dircycle plugin: enables cycling through the directory
-# stack using Ctrl+Shift+Left/Right
+# enables cycling through the directory stack using
+# Ctrl+Shift+Left/Right
+#
+# left/right direction follows the order in which directories
+# were visited, like left/right arrows do in a browser
-eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
+# NO_PUSHD_MINUS syntax:
+# pushd +N: start counting from left of `dirs' output
+# pushd -N: start counting from right of `dirs' output
+
+insert-cycledleft () {
+ emulate -L zsh
+ setopt nopushdminus
+
+ builtin pushd -q +1 &>/dev/null || true
+ zle reset-prompt
+}
zle -N insert-cycledleft
-bindkey "\e[1;6D" insert-cycledleft
-eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q +0'; zle accept-line }"
+
+insert-cycledright () {
+ emulate -L zsh
+ setopt nopushdminus
+
+ builtin pushd -q -0 &>/dev/null || true
+ zle reset-prompt
+}
zle -N insert-cycledright
-bindkey "\e[1;6C" insert-cycledright
+
+
+# add key bindings for iTerm2
+if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
+ bindkey "^[[1;6D" insert-cycledleft
+ bindkey "^[[1;6C" insert-cycledright
+else
+ bindkey "\e[1;6D" insert-cycledleft
+ bindkey "\e[1;6C" insert-cycledright
+fi \ No newline at end of file
diff --git a/plugins/docker/_docker b/plugins/docker/_docker
index 880b6faa6..aadc9c61d 100644
--- a/plugins/docker/_docker
+++ b/plugins/docker/_docker
@@ -11,7 +11,7 @@
# Output a selectable list of all running docker containers
__docker_containers() {
declare -a cont_cmd
- cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}'))
+ cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
_describe 'containers' cont_cmd
}
@@ -219,6 +219,10 @@ __start() {
__docker_containers
}
+__stats() {
+ __docker_containers
+}
+
__stop() {
_arguments \
'(-t,--time=)'{-t,--time=}'[Number of seconds to wait for the container to stop before killing it.]'
@@ -280,6 +284,7 @@ _1st_arguments=(
"save":"Save an image to a tar archive"
"search":"Search for an image in the docker index"
"start":"Start a stopped container"
+ "stats":"Display a live stream of one or more containers' resource usage statistics"
"stop":"Stop a running container"
"tag":"Tag an image into a repository"
"top":"Lookup the running processes of a container"
@@ -351,6 +356,8 @@ case "$words[1]" in
__save ;;
search)
__search ;;
+ stats)
+ __stats ;;
start)
__start ;;
stop)
diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
index 01b8a88d9..d868a5fe1 100644
--- a/plugins/git-prompt/git-prompt.plugin.zsh
+++ b/plugins/git-prompt/git-prompt.plugin.zsh
@@ -2,9 +2,6 @@
# http://github.com/olivierverdier/zsh-git-prompt
#
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
-# Initialize colors.
-autoload -U colors
-colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
diff --git a/plugins/jhbuild/README.md b/plugins/jhbuild/README.md
new file mode 100644
index 000000000..910526966
--- /dev/null
+++ b/plugins/jhbuild/README.md
@@ -0,0 +1,4 @@
+## JHBuild
+**Maintainer:** [Miguel Vaello](https://github.com/miguxbe)
+
+This plugin adds some jhbuild aliases and increase the completion function provided by zsh.
diff --git a/plugins/jhbuild/jhbuild.plugin.zsh b/plugins/jhbuild/jhbuild.plugin.zsh
new file mode 100644
index 000000000..fed1bc9fc
--- /dev/null
+++ b/plugins/jhbuild/jhbuild.plugin.zsh
@@ -0,0 +1,28 @@
+# Aliases
+#
+alias jh='jhbuild'
+# Build
+alias jhb='jhbuild build'
+alias jhbo='jhbuild buildone'
+# Checks
+alias jhckb='jhbuild checkbranches'
+alias jhckm='jhbuild checkmodulesets'
+# Info & list
+alias jhi='jhbuild info'
+alias jhl='jhbuild list'
+# Clean
+alias jhc='jhbuild clean'
+alias jhco='jhbuild cleanone'
+# Run
+alias jhr='jhbuild run'
+# Depends
+alias jhrd='jhbuild rdepends'
+alias jhsd='jhbuild sysdeps'
+# Update
+alias jhu='jhbuild update'
+alias jhuo='jhbuild updateone'
+# Uninstall
+alias jhun='jhbuild uninstall'
+
+
+
diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
index b16814fe4..d082c11e5 100644
--- a/plugins/jump/jump.plugin.zsh
+++ b/plugins/jump/jump.plugin.zsh
@@ -27,7 +27,6 @@ unmark() {
rm -i "$MARKPATH/$1"
}
-autoload colors
marks() {
for link in $MARKPATH/*(@); do
local markname="$fg[cyan]${link:t}$reset_color"
diff --git a/plugins/laravel4/laravel4.plugin.zsh b/plugins/laravel4/laravel4.plugin.zsh
index 4b1022b66..0edc84970 100644
--- a/plugins/laravel4/laravel4.plugin.zsh
+++ b/plugins/laravel4/laravel4.plugin.zsh
@@ -1,6 +1,6 @@
# Laravel4 basic command completion
_laravel4_get_command_list () {
- php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
+ php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
_laravel4 () {
diff --git a/plugins/laravel5/laravel5.plugin.zsh b/plugins/laravel5/laravel5.plugin.zsh
new file mode 100644
index 000000000..2afa99317
--- /dev/null
+++ b/plugins/laravel5/laravel5.plugin.zsh
@@ -0,0 +1,20 @@
+# Laravel5 basic command completion
+_laravel5_get_command_list () {
+ php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
+}
+
+_laravel5 () {
+ if [ -f artisan ]; then
+ compadd `_laravel5_get_command_list`
+ fi
+}
+
+compdef _laravel5 artisan
+compdef _laravel5 la5
+
+#Alias
+alias la5='php artisan'
+
+alias la5dump='php artisan dump-autoload'
+alias la5cache='php artisan cache:clear'
+alias la5routes='php artisan routes'
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index e472578b0..4fa6fcc34 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -5,7 +5,7 @@
# Flag indicating if we've previously jumped to last directory.
typeset -g ZSH_LAST_WORKING_DIRECTORY
mkdir -p $ZSH_CACHE_DIR
-local cache_file="$ZSH_CACHE_DIR/last-working-dir"
+cache_file="$ZSH_CACHE_DIR/last-working-dir"
# Updates the last directory once directory is changed.
function chpwd() {
diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh
index d12e06853..e3ba39918 100644
--- a/plugins/sudo/sudo.plugin.zsh
+++ b/plugins/sudo/sudo.plugin.zsh
@@ -13,9 +13,8 @@
# ------------------------------------------------------------------------------
sudo-command-line() {
-[[ -z $BUFFER ]] && zle up-history
-[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
-zle end-of-line
+ [[ -z $BUFFER ]] && zle up-history
+ [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER"
}
zle -N sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 3ed32b3fb..f2745b409 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -14,6 +14,14 @@ function zle-keymap-select zle-line-init zle-line-finish {
zle -R
}
+# Ensure that the prompt is redrawn when the terminal size changes.
+TRAPWINCH() {
+ if [[ -o zle ]]; then
+ zle reset-prompt
+ zle -R
+ fi
+}
+
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 52e02d3e0..5faa1a823 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -1,65 +1,70 @@
virtualenvwrapper='virtualenvwrapper.sh'
-if (( $+commands[$virtualenvwrapper] )); then
+if (( $+commands[$virtualenvwrapper] )); then
source ${${virtualenvwrapper}:c}
+elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
+ virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper"
+ source "/etc/bash_completion.d/virtualenvwrapper"
+else
+ print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
+ "Please install with \`pip install virtualenvwrapper\`" >&2
+ return
+fi
+if ! type workon &>/dev/null; then
+ print "zsh virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
+ "Please check ${virtualenvwrapper}" >&2
+ return
+fi
- if [[ "$WORKON_HOME" == "" ]]; then
- echo "\$WORKON_HOME is not defined so ZSH plugin virtualenvwrapper will not work"
- else
+if [[ "$WORKON_HOME" == "" ]]; then
+ print "\$WORKON_HOME is not defined so ZSH plugin virtualenvwrapper will not work" >&2
+ return
+fi
- if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
- # Automatically activate Git projects's 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 {
- if [ ! $WORKON_CWD ]; then
- WORKON_CWD=1
- # Check if this is a Git repo
- PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
- if (( $? != 0 )); then
- PROJECT_ROOT="."
- fi
- # Check for virtualenv name override
- if [[ -f "$PROJECT_ROOT/.venv" ]]; then
- ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
- elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
- ENV_NAME="$PROJECT_ROOT/.venv"
- elif [[ "$PROJECT_ROOT" != "." ]]; then
- ENV_NAME=`basename "$PROJECT_ROOT"`
- else
- ENV_NAME=""
- fi
- if [[ "$ENV_NAME" != "" ]]; then
- # 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"
- elif [[ -e "$ENV_NAME/bin/activate" ]]; then
- source $ENV_NAME/bin/activate && 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
+if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
+ # Automatically activate Git projects's 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 {
+ if [ ! $WORKON_CWD ]; then
+ WORKON_CWD=1
+ # Check if this is a Git repo
+ PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
+ if (( $? != 0 )); then
+ PROJECT_ROOT="."
+ fi
+ # Check for virtualenv name override
+ if [[ -f "$PROJECT_ROOT/.venv" ]]; then
+ ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
+ elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
+ ENV_NAME="$PROJECT_ROOT/.venv"
+ elif [[ "$PROJECT_ROOT" != "." ]]; then
+ ENV_NAME=`basename "$PROJECT_ROOT"`
+ else
+ ENV_NAME=""
+ fi
+ if [[ "$ENV_NAME" != "" ]]; then
+ # 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"
+ elif [[ -e "$ENV_NAME/bin/activate" ]]; then
+ source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
- unset PROJECT_ROOT
- unset WORKON_CWD
- fi
- }
-
- # Append workon_cwd to the chpwd_functions array, so it will be called on cd
- # http://zsh.sourceforge.net/Doc/Release/Functions.html
- # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4
- if (( ${+chpwd_functions} )); then
- if (( $chpwd_functions[(I)workon_cwd] == 0 )); then
- set -A chpwd_functions $chpwd_functions workon_cwd
fi
- else
- set -A chpwd_functions workon_cwd
+ elif [[ -n $CD_VIRTUAL_ENV && -n $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
+ unset WORKON_CWD
fi
+ }
+
+ # Append workon_cwd to the chpwd_functions array, so it will be called on cd
+ # http://zsh.sourceforge.net/Doc/Release/Functions.html
+ if ! (( $chpwd_functions[(I)workon_cwd] )); then
+ chpwd_functions+=(workon_cwd)
fi
-else
- print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}. Please install with \`pip install virtualenvwrapper\`."
fi
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index 28559deb9..572427b0b 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -1,43 +1,46 @@
# web_search from terminal
function web_search() {
- # get the open command
- local open_cmd
- if [[ "$OSTYPE" = darwin* ]]; then
- open_cmd='open'
- else
- open_cmd='xdg-open'
- fi
+ emulate -L zsh
+
+ # define search engine URLS
+ typeset -A urls
+ urls=(
+ google "https://www.google.com/search?q="
+ bing "https://www.bing.com/search?q="
+ yahoo "https://search.yahoo.com/search?p="
+ duckduckgo "https://www.duckduckgo.com/?q="
+ yandex "https://yandex.ru/yandsearch?text="
+ )
+
+ # define the open command
+ case "$OSTYPE" in
+ darwin*) open_cmd="open" ;;
+ cygwin*) open_cmd="cygstart" ;;
+ linux*) open_cmd="xdg-open" ;;
+ *) echo "Platform $OSTYPE not supported"
+ return 1
+ ;;
+ esac
# check whether the search engine is supported
- if [[ ! $1 =~ '(google|bing|yahoo|duckduckgo)' ]];
- then
+ if [[ -z "$urls[$1]" ]]; then
echo "Search engine $1 not supported."
return 1
fi
- local url="http://www.$1.com"
-
- # no keyword provided, simply open the search engine homepage
- if [[ $# -le 1 ]]; then
- $open_cmd "$url"
- return
- fi
- if [[ $1 == 'duckduckgo' ]]; then
- #slightly different search syntax for DDG
- url="${url}/?q="
+ # search or go to main page depending on number of arguments passed
+ if [[ $# -gt 1 ]]; then
+ # build search url:
+ # join arguments passed with '+', then append to search engine URL
+ url="${urls[$1]}${(j:+:)@[2,-1]}"
else
- url="${url}/search?q="
+ # build main page url:
+ # split by '/', then rejoin protocol (1) and domain (2) parts with '//'
+ url="${(j://:)${(s:/:)urls[$1]}[1,2]}"
fi
- shift # shift out $1
-
- while [[ $# -gt 0 ]]; do
- url="${url}$1+"
- shift
- done
- url="${url%?}" # remove the last '+'
- nohup $open_cmd "$url" >/dev/null 2&>1
+ nohup $open_cmd "$url" &>/dev/null
}
@@ -45,6 +48,8 @@ alias bing='web_search bing'
alias google='web_search google'
alias yahoo='web_search yahoo'
alias ddg='web_search duckduckgo'
+alias yandex='web_search yandex'
+
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
alias news='web_search duckduckgo \!n'
diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
index 6869c8a20..212b823a5 100644
--- a/themes/adben.zsh-theme
+++ b/themes/adben.zsh-theme
@@ -69,17 +69,17 @@ function precmd {
#Choose from all databases, regardless of whether they are considered "offensive"
fortune -a
}
- #obtains the tip
+ #obtains the tip
ps1_command_tip () {
wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
- }
+ }
prompt_header () {
if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
ps1_command_tip
else
ps1_fortune
- fi
- }
+ fi
+ }
PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
# set a simple variable to show when in screen
if [[ -n "${WINDOW}" ]]; then
@@ -99,11 +99,8 @@ prompt_context () {
set_prompt () {
# required for the prompt
setopt prompt_subst
- autoload colors zsh/terminfo
- if [[ "$terminfo[colors]" -gt 8 ]]; then
- colors
- fi
-
+ autoload zsh/terminfo
+
# ######### PROMPT #########
PROMPT='${PROMPT_HEAD}
${RED_START}$(prompt_context)
diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme
index 275341dc6..95e6249fa 100644
--- a/themes/apple.zsh-theme
+++ b/themes/apple.zsh-theme
@@ -7,7 +7,6 @@ get_git_dirty() {
}
autoload -Uz vcs_info
-autoload -U colors && colors
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes
zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes
diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
index 0519fbefb..ab154c1e5 100644
--- a/themes/gnzh.zsh-theme
+++ b/themes/gnzh.zsh-theme
@@ -2,8 +2,7 @@
# Based on bira theme
# load some modules
-autoload -U colors zsh/terminfo # Used in the colour alias below
-colors
+autoload -U zsh/terminfo # Used in the colour alias below
setopt prompt_subst
# make some aliases for the colours: (could use normal escape sequences too)
diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme
index 942affa94..a3c505706 100644
--- a/themes/half-life.zsh-theme
+++ b/themes/half-life.zsh-theme
@@ -13,8 +13,6 @@ function virtualenv_info {
PR_GIT_UPDATE=1
setopt prompt_subst
-autoload colors
-colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
index bca92970c..2f0e77431 100644
--- a/themes/jonathan.zsh-theme
+++ b/themes/jonathan.zsh-theme
@@ -44,10 +44,7 @@ setprompt () {
###
# See if we can use colors.
- autoload colors zsh/terminfo
- if [[ "$terminfo[colors]" -ge 8 ]]; then
- colors
- fi
+ autoload zsh/terminfo
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme
index e743289c3..51b0af724 100644
--- a/themes/kolo.zsh-theme
+++ b/themes/kolo.zsh-theme
@@ -1,5 +1,3 @@
-autoload -U colors && colors
-
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
diff --git a/themes/linuxonly.zsh-theme b/themes/linuxonly.zsh-theme
index a11b80d7f..f9e0aa07d 100644
--- a/themes/linuxonly.zsh-theme
+++ b/themes/linuxonly.zsh-theme
@@ -13,7 +13,6 @@ local c7=$(printf "\033[38;5;149m")
local c8=$(printf "\033[38;5;126m")
local c9=$(printf "\033[38;5;162m")
-local foopath=$(perl /home/scp1/bin/foopath)
if [ "$TERM" = "linux" ]; then
c1=$(printf "\033[34;1m")
diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme
index 943f04d38..a95383ba5 100644
--- a/themes/mikeh.zsh-theme
+++ b/themes/mikeh.zsh-theme
@@ -1,6 +1,4 @@
setopt prompt_subst
-autoload colors
-colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme
index eed084f15..8585e66be 100644
--- a/themes/rkj-repos.zsh-theme
+++ b/themes/rkj-repos.zsh-theme
@@ -16,13 +16,15 @@ ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈"
+ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[grey]%}"
+ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
function mygit() {
- ref1=$(git symbolic-ref HEAD 2> /dev/null) || return
- ref2=$(git rev-parse HEAD | head -c 6) || return
- ref="$ref1 %{$fg[grey]%}$ref2"
- #ref=$(git symbolic-ref HEAD 2> /dev/null) $(git rev-parse HEAD | head -c 6) || return
- echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
+ if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
+ ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
+ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
+ fi
}
function retcode() {}
diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme
index fb4d32e24..63ce4261b 100644
--- a/themes/simonoff.zsh-theme
+++ b/themes/simonoff.zsh-theme
@@ -63,10 +63,7 @@ setprompt () {
###
# See if we can use colors.
- autoload colors zsh/terminfo
- if [[ "$terminfo[colors]" -ge 8 ]]; then
- colors
- fi
+ autoload zsh/terminfo
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme
index e38188d35..13728ca9a 100644
--- a/themes/steeef.zsh-theme
+++ b/themes/steeef.zsh-theme
@@ -15,8 +15,6 @@ function virtualenv_info {
PR_GIT_UPDATE=1
setopt prompt_subst
-autoload colors
-colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme
index 5c0854730..27597ec6c 100644
--- a/themes/zhann.zsh-theme
+++ b/themes/zhann.zsh-theme
@@ -1,5 +1,3 @@
-autoload -U colors && colors
-
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
diff --git a/tools/install.sh b/tools/install.sh
index 69213d4a3..bd4c55749 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -23,8 +23,8 @@ fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
-sed -i -e "/^ZSH=/ c\\
-ZSH=$ZSH
+sed -i -e "/^export ZSH=/ c\\
+export ZSH=$ZSH
" ~/.zshrc
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"