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

Preserve the original PROMPT_COMMAND: thanks to "courts"

for the original implementation
(http://n2.nabble.com/Preserving-COMMAND_PROMPT-td2507773.html)
This commit is contained in:
Joël Schaerer 2009-04-10 13:00:20 +02:00
parent dc4c63c9ea
commit 264eea2756

View File

@ -9,6 +9,9 @@ _autojump()
return 0
}
complete -F _autojump j
export PROMPT_COMMAND='(autojump -a "$(pwd -P)"&)>/dev/null'
AUTOJUMP='(autojump -a "$(pwd -P)"&)>/dev/null'
if ! [[ $PROMPT_COMMAND =~ autojump ]]; then
export PROMPT_COMMAND="$PROMPT_COMMAND && $AUTOJUMP"
fi
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 }