summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/debian/debian.plugin.zsh4
-rw-r--r--plugins/postgres/postgres.plugin.zsh6
-rw-r--r--plugins/virtualenv/virtualenv.plugin.zsh7
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh25
4 files changed, 26 insertions, 16 deletions
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 55b90e379..b51d0cd37 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -6,14 +6,14 @@
# Use aptitude if installed, or apt-get if not.
# You can just set apt_pref='apt-get' to override it.
-if [[ -e $( which aptitude 2>&1 ) ]]; then
+if [[ -e $( which -p aptitude 2>&1 ) ]]; then
apt_pref='aptitude'
else
apt_pref='apt-get'
fi
# Use sudo by default if it's installed
-if [[ -e $( which sudo 2>&1 ) ]]; then
+if [[ -e $( which -p sudo 2>&1 ) ]]; then
use_sudo=1
fi
diff --git a/plugins/postgres/postgres.plugin.zsh b/plugins/postgres/postgres.plugin.zsh
new file mode 100644
index 000000000..cdd142e92
--- /dev/null
+++ b/plugins/postgres/postgres.plugin.zsh
@@ -0,0 +1,6 @@
+# Aliases to stop, start and restart Postgres
+# Paths noted below are for Postgress installed via Homebrew on OSX
+
+alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
+alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
+alias restartpost='stoppost && sleep 1 && startpost' \ No newline at end of file
diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
index e8458389f..8e06450b1 100644
--- a/plugins/virtualenv/virtualenv.plugin.zsh
+++ b/plugins/virtualenv/virtualenv.plugin.zsh
@@ -1,9 +1,8 @@
function virtualenv_prompt_info(){
- local virtualenv_path="$VIRTUAL_ENV"
- if [[ -n $virtualenv_path ]]; then
- local virtualenv_name=`basename $virtualenv_path`
- printf "%s[%s] " "%{${fg[yellow]}%}" $virtualenv_name
+ if [[ -n $VIRTUAL_ENV ]]; then
+ printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t}
fi
}
+# disables prompt mangling in virtual_env/bin/activate
export VIRTUAL_ENV_DISABLE_PROMPT=1
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 35de50874..670c287bd 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -1,10 +1,9 @@
-wrapsource=`which virtualenvwrapper_lazy.sh`
-
-if [[ -f "$wrapsource" ]]; then
- source $wrapsource
+virtualenvwrapper='virtualenvwrapper_lazy.sh'
+if (( $+commands[$virtualenvwrapper] )); then
+ source ${${virtualenvwrapper}:c}
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
- # Automatically activate Git projects' virtual environments based on the
+ # 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 {
@@ -40,11 +39,17 @@ if [[ -f "$wrapsource" ]]; then
fi
}
- # New cd function that does the virtualenv magic
- function cd {
- builtin cd "$@" && workon_cwd
- }
+ # 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
+ fi
fi
else
- print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
+ print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}. Please install with \`pip install virtualenvwrapper\`."
fi