1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Enable autojump only in interactive mode

This commit is contained in:
Timothée Ravier 2013-06-26 22:15:33 +02:00
parent d692bc644a
commit b35aa9b05a
2 changed files with 7 additions and 3 deletions

View File

@ -65,7 +65,9 @@ case $PROMPT_COMMAND in
*autojump*) *autojump*)
;; ;;
*) *)
PROMPT_COMMAND="${PROMPT_COMMAND:+$(echo "${PROMPT_COMMAND}" | awk '{gsub(/; *$/,"")}1') ; }autojump_add_to_database" if [ -n "$PS1" ]; then
PROMPT_COMMAND="${PROMPT_COMMAND:+$(echo "${PROMPT_COMMAND}" | awk '{gsub(/; *$/,"")}1') ; }autojump_add_to_database"
fi
;; ;;
esac esac

View File

@ -29,8 +29,10 @@ function autojump_chpwd() {
{ (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/autojump_errors ; } 2>/dev/null { (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/autojump_errors ; } 2>/dev/null
} }
typeset -ga chpwd_functions if [ -n "$PS1" ]; then
chpwd_functions+=autojump_chpwd typeset -ga chpwd_functions
chpwd_functions+=autojump_chpwd
fi
function j { function j {
# Cannot use =~ due to MacPorts zsh v4.2, see issue #125. # Cannot use =~ due to MacPorts zsh v4.2, see issue #125.