From ae978d331973719e5a2aba7f81159b83787b15cd Mon Sep 17 00:00:00 2001 From: William Ting Date: Fri, 1 Feb 2013 15:00:26 -0600 Subject: [PATCH] use zsh change directory hook rather than pre-command hook --- bin/autojump | 2 +- bin/autojump.zsh | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/autojump b/bin/autojump index f3a9b22..ebd3aa9 100755 --- a/bin/autojump +++ b/bin/autojump @@ -34,7 +34,7 @@ import re import shutil from tempfile import NamedTemporaryFile -VERSION = 'release-v21.4.1' +VERSION = 'release-v21.4.2' MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 1000 COMPLETION_SEPARATOR = '__' diff --git a/bin/autojump.zsh b/bin/autojump.zsh index 8694cb2..6eb6435 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -23,8 +23,7 @@ command -v brew &>/dev/null \ && [[ -d "`brew --prefix`/share/zsh/site-functions" ]] \ && fpath=(`brew --prefix`/share/zsh/site-functions ${fpath}) -# TODO: switch this to a chpwd hook instead (2013.02.01_1319, ting) -function autojump_preexec() { +function autojump_chpwd() { if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]; then _PWD_ARGS="" else @@ -33,8 +32,8 @@ function autojump_preexec() { { (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null } -typeset -ga preexec_functions -preexec_functions+=autojump_preexec +typeset -ga chpwd_functions +chpwd_functions+=autojump_chpwd function j { # Cannot use =~ due to MacPorts zsh v4.2, see issue #125.