mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
parent
3d6bf541cf
commit
573c1ea418
@ -13,6 +13,10 @@ else
|
||||
export AUTOJUMP_ERROR_PATH=~/.local/share/autojump/errors.log
|
||||
fi
|
||||
|
||||
if [[ ! -d "$(dirname ${AUTOJUMP_ERROR_PATH})" ]]; then
|
||||
mkdir -p "$(dirname ${AUTOJUMP_ERROR_PATH})"
|
||||
fi
|
||||
|
||||
|
||||
# enable tab completion
|
||||
_autojump() {
|
||||
@ -30,7 +34,11 @@ complete -F _autojump j
|
||||
|
||||
# change pwd hook
|
||||
autojump_add_to_database() {
|
||||
(autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &) &>/dev/null
|
||||
if [[ -f "${AUTOJUMP_ERROR_PATH}" ]]; then
|
||||
(autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &) &>/dev/null
|
||||
else
|
||||
(autojump --add "$(pwd)" >/dev/null &) &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case $PROMPT_COMMAND in
|
||||
|
@ -20,10 +20,18 @@ else
|
||||
export AUTOJUMP_ERROR_PATH=~/.local/share/autojump/errors.log
|
||||
fi
|
||||
|
||||
if [[ ! -d "$(dirname ${AUTOJUMP_ERROR_PATH})" ]]; then
|
||||
mkdir -p "$(dirname ${AUTOJUMP_ERROR_PATH})"
|
||||
fi
|
||||
|
||||
|
||||
# change pwd hook
|
||||
autojump_chpwd() {
|
||||
autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &!
|
||||
if [[ -f "${AUTOJUMP_ERROR_PATH}" ]]; then
|
||||
autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &!
|
||||
else
|
||||
autojump --add "$(pwd)" >/dev/null &!
|
||||
fi
|
||||
}
|
||||
|
||||
typeset -gaU chpwd_functions
|
||||
|
Loading…
Reference in New Issue
Block a user