From ea884972e659478af3ce3d0d77b4419975054213 Mon Sep 17 00:00:00 2001 From: Simon Marache-Francisco Date: Mon, 30 Mar 2009 09:34:24 +0200 Subject: [PATCH] Added everything and corrected bug --- autojump.sh | 5 +++-- autojump.zsh | 4 ++++ install.zsh | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/autojump.sh b/autojump.sh index 2202663..6635380 100755 --- a/autojump.sh +++ b/autojump.sh @@ -1,5 +1,6 @@ -#Source autojump.bashrc only if we're on bash, as it is -#not compatible with other shells +# Source autojump on BASH or ZSH depending on the shell if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then . /etc/profile.d/autojump.bash +elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then + . /etc/profile.d/autojump.zsh fi diff --git a/autojump.zsh b/autojump.zsh index c686535..08cb4a7 100755 --- a/autojump.zsh +++ b/autojump.zsh @@ -1,3 +1,7 @@ +function preexec() { + (autojump -a "$(pwd -P)"&)>/dev/null +} + alias jumpstat="autojump --stat" function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";fi } diff --git a/install.zsh b/install.zsh index 7a412cc..899e871 100755 --- a/install.zsh +++ b/install.zsh @@ -16,6 +16,7 @@ cp _j $(echo $FPATH | cut -d":" -f 1) if [ -d "/etc/profile.d" ]; then sudo cp autojump.zsh /etc/profile.d/ + sudo cp autojump.sh /etc/profile.d/ echo "Remember to add the line" echo " source /etc/profile" echo "to your ~/.zshrc if it's not there already"