Merge branch 'fix_wrappers'

Conflicts:
	bin/autojump
	bin/autojump_data.py
	bin/autojump_utils.py
	tests/autojump_utils_test.py
pull/252/head
William Ting 11 years ago
commit b80c630ef8

@ -1,9 +1,19 @@
# set user installation paths # set user installation paths
if [ -d ~/.autojump/ ]; then if [[ -d ~/.autojump/ ]]; then
export PATH=~/.autojump/bin:"${PATH}" export PATH=~/.autojump/bin:"${PATH}"
fi fi
# set error file location
if [[ "$(uname)" == "Darwin" ]]; then
export AUTOJUMP_ERROR_PATH=~/Library/autojump/errors.log
elif [[ -n "${XDG_DATA_HOME}" ]]; then
export AUTOJUMP_ERROR_PATH="${XDG_DATA_HOME}/autojump/errors.log"
else
export AUTOJUMP_ERROR_PATH=~/.local/share/autojump/errors.log
fi
# enable tab completion # enable tab completion
_autojump() { _autojump() {
local cur local cur
@ -20,7 +30,7 @@ complete -F _autojump j
# change pwd hook # change pwd hook
autojump_add_to_database() { autojump_add_to_database() {
(autojump -a "$(pwd)" &) &>/dev/null (autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &) &>/dev/null
} }
case $PROMPT_COMMAND in case $PROMPT_COMMAND in
@ -40,7 +50,7 @@ j() {
fi fi
new_path="$(autojump ${@})" new_path="$(autojump ${@})"
if [ -d "${new_path}" ]; then if [[ -d "${new_path}" ]]; then
echo -e "\\033[31m${new_path}\\033[0m" echo -e "\\033[31m${new_path}\\033[0m"
cd "${new_path}" cd "${new_path}"
else else
@ -69,7 +79,7 @@ jo() {
fi fi
new_path="$(autojump ${@})" new_path="$(autojump ${@})"
if [ -d "${new_path}" ]; then if [[ -d "${new_path}" ]]; then
case ${OSTYPE} in case ${OSTYPE} in
linux-gnu) linux-gnu)
xdg-open "${new_path}" xdg-open "${new_path}"

@ -17,6 +17,7 @@ end
# misc helper functions # misc helper functions
function __aj_err function __aj_err
# TODO(ting|#247): set error file location
echo $argv 1>&2; false echo $argv 1>&2; false
end end

@ -1,6 +1,6 @@
# source autojump on BASH or ZSH depending on the shell # source autojump on BASH or ZSH depending on the shell
shell=`echo ${SHELL} | awk -F/ '{ print $NF }'` shell=$(echo ${SHELL} | awk -F/ '{ print $NF }')
# prevent circular loop for sh shells # prevent circular loop for sh shells
if [ "${shell}" = "sh" ]; then if [ "${shell}" = "sh" ]; then

@ -1,22 +1,29 @@
# set user installation paths # set user installation paths
if [[ -d ${HOME}/.autojump ]]; then if [[ -d ~/.autojump ]]; then
path=(${HOME}/.autojump/bin ${path}) path=(~/.autojump/bin ${path})
fpath=(${HOME}/.autojump/functions/ ${fpath}) fpath=(~/.autojump/functions/ ${fpath})
fi fi
# set homebrew installation paths # set homebrew installation paths
command -v brew &>/dev/null \ if command -v brew && [[ -d "$(brew --prefix)/share/zsh/site-functions" ]]; then
&& [[ -d "`brew --prefix`/share/zsh/site-functions" ]] \ fpath=("$(brew --prefix)/share/zsh/site-functions" ${fpath})
&& fpath=(`brew --prefix`/share/zsh/site-functions ${fpath}) fi
# tab completion handled by _j file # set error file location
if [[ "$(uname)" == "Darwin" ]]; then
export AUTOJUMP_ERROR_PATH=~/Library/autojump/errors.log
elif [[ -n "${XDG_DATA_HOME}" ]]; then
export AUTOJUMP_ERROR_PATH="${XDG_DATA_HOME}/autojump/errors.log"
else
export AUTOJUMP_ERROR_PATH=~/.local/share/autojump/errors.log
fi
# change pwd hook # change pwd hook
autojump_chpwd() { autojump_chpwd() {
(autojump -a "$(pwd)" &) &>/dev/null autojump --add "$(pwd)" >/dev/null 2>${AUTOJUMP_ERROR_PATH} &!
} }
typeset -gaU chpwd_functions typeset -gaU chpwd_functions
@ -31,7 +38,7 @@ j() {
fi fi
local new_path="$(autojump ${@})" local new_path="$(autojump ${@})"
if [ -d "${new_path}" ]; then if [[ -d "${new_path}" ]]; then
echo -e "\\033[31m${new_path}\\033[0m" echo -e "\\033[31m${new_path}\\033[0m"
cd "${new_path}" cd "${new_path}"
else else
@ -60,7 +67,7 @@ jo() {
fi fi
local new_path="$(autojump ${@})" local new_path="$(autojump ${@})"
if [ -d "${new_path}" ]; then if [[ -d "${new_path}" ]]; then
case ${OSTYPE} in case ${OSTYPE} in
linux-gnu) linux-gnu)
xdg-open "${new_path}" xdg-open "${new_path}"

Loading…
Cancel
Save