mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
Revert "remove _j() as it was never used to begin with."
This reverts commit 49a0d702ba
.
Conflicts:
bin/autojump
Closes #178, #181.
This commit is contained in:
parent
833dcca408
commit
17d31d881e
6
bin/_j
Normal file
6
bin/_j
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#compdef j
|
||||||
|
cur=${words[2, -1]}
|
||||||
|
|
||||||
|
autojump --complete ${=cur[*]} | while read i; do
|
||||||
|
compadd -U "$i";
|
||||||
|
done
|
@ -37,6 +37,7 @@ chpwd_functions+=autojump_chpwd
|
|||||||
|
|
||||||
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.
|
||||||
|
echo "j()"
|
||||||
if [[ ${@} == -* ]]; then
|
if [[ ${@} == -* ]]; then
|
||||||
autojump ${@}
|
autojump ${@}
|
||||||
return
|
return
|
||||||
@ -54,6 +55,7 @@ function j {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function jc {
|
function jc {
|
||||||
|
echo "j()"
|
||||||
if [[ ${@} == -* ]]; then
|
if [[ ${@} == -* ]]; then
|
||||||
j ${@}
|
j ${@}
|
||||||
else
|
else
|
||||||
|
35
install.sh
35
install.sh
@ -3,12 +3,13 @@
|
|||||||
function help_msg {
|
function help_msg {
|
||||||
echo "./install.sh [OPTION..]"
|
echo "./install.sh [OPTION..]"
|
||||||
echo
|
echo
|
||||||
echo " -a, --auto Try to determine destdir, prefix"
|
echo " -a, --auto Try to determine destdir, prefix (and zshshare if applicable)"
|
||||||
echo " -g, --global Use default global settings (destdir=/; prefix=usr)"
|
echo " -g, --global Use default global settings (destdir=/; prefix=usr)"
|
||||||
echo " -l, --local Use default local settings (destdir=~/.autojump)"
|
echo " -l, --local Use default local settings (destdir=~/.autojump)"
|
||||||
echo
|
echo
|
||||||
echo " -d, --destdir PATH Set install destination to PATH"
|
echo " -d, --destdir PATH Set install destination to PATH"
|
||||||
echo " -p, --prefix PATH Use PATH as prefix"
|
echo " -p, --prefix PATH Use PATH as prefix"
|
||||||
|
echo " -Z, --zshshare PATH Use PATH as zsh share destination"
|
||||||
echo
|
echo
|
||||||
echo " -f, --force Ignore Python version check"
|
echo " -f, --force Ignore Python version check"
|
||||||
echo " -n, --dry_run Only show installation paths, don't install anything"
|
echo " -n, --dry_run Only show installation paths, don't install anything"
|
||||||
@ -19,6 +20,11 @@ function help_msg {
|
|||||||
echo ' Documentation: $destdir$prefix/share/man/man1'
|
echo ' Documentation: $destdir$prefix/share/man/man1'
|
||||||
echo ' Icon: $destdir$prefix/share/autojump'
|
echo ' Icon: $destdir$prefix/share/autojump'
|
||||||
echo ' Shell scripts: $destdir/etc/profile.d'
|
echo ' Shell scripts: $destdir/etc/profile.d'
|
||||||
|
echo ' zsh functions: $destdir$zshsharedir'
|
||||||
|
echo
|
||||||
|
echo 'Unless specified, $zshshare will be :'
|
||||||
|
echo ' - $destdir$prefix/functions for local installations'
|
||||||
|
echo ' - $destdir$prefix/share/zsh/site-functions for all other installations'
|
||||||
}
|
}
|
||||||
|
|
||||||
dry_run=
|
dry_run=
|
||||||
@ -28,6 +34,7 @@ force=
|
|||||||
shell=`echo ${SHELL} | awk -F/ '{ print $NF }'`
|
shell=`echo ${SHELL} | awk -F/ '{ print $NF }'`
|
||||||
destdir=
|
destdir=
|
||||||
prefix="usr/local"
|
prefix="usr/local"
|
||||||
|
zshsharedir=
|
||||||
|
|
||||||
# If no arguments passed, default to --auto.
|
# If no arguments passed, default to --auto.
|
||||||
if [[ ${#} == 0 ]]; then
|
if [[ ${#} == 0 ]]; then
|
||||||
@ -91,6 +98,14 @@ while true; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
-Z|--zshshare)
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
zshsharedir=$2; shift 2
|
||||||
|
else
|
||||||
|
echo "--zshshare or -Z requires an argument" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -137,6 +152,18 @@ if [[ ${shell} != "bash" ]] && [[ ${shell} != "zsh" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# zsh functions
|
||||||
|
if [[ $shell == "zsh" ]]; then
|
||||||
|
if [[ -z $zshsharedir ]]; then
|
||||||
|
# if not set, use a default
|
||||||
|
if [[ $local ]]; then
|
||||||
|
zshsharedir="${prefix}functions"
|
||||||
|
else
|
||||||
|
zshsharedir="${prefix}share/zsh/site-functions"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# check Python version
|
# check Python version
|
||||||
if [ ! ${force} ]; then
|
if [ ! ${force} ]; then
|
||||||
python_version=`python -c 'import sys; print(sys.version_info[:])'`
|
python_version=`python -c 'import sys; print(sys.version_info[:])'`
|
||||||
@ -167,6 +194,9 @@ echo "Binary: ${destdir}${prefix}bin/"
|
|||||||
echo "Documentation: ${destdir}${prefix}share/man/man1/"
|
echo "Documentation: ${destdir}${prefix}share/man/man1/"
|
||||||
echo "Icon: ${destdir}${prefix}share/autojump/"
|
echo "Icon: ${destdir}${prefix}share/autojump/"
|
||||||
echo "Shell scripts: ${destdir}etc/profile.d/"
|
echo "Shell scripts: ${destdir}etc/profile.d/"
|
||||||
|
if [[ -z $shell ]] || [[ $shell == "zsh" ]]; then
|
||||||
|
echo "zsh functions: ${destdir}${zshsharedir}"
|
||||||
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [[ $dry_run ]]; then
|
if [[ $dry_run ]]; then
|
||||||
@ -186,6 +216,9 @@ mkdir -p ${destdir}etc/profile.d/ || exit 1
|
|||||||
cp -v ./bin/autojump.sh ${destdir}etc/profile.d/ || exit 1
|
cp -v ./bin/autojump.sh ${destdir}etc/profile.d/ || exit 1
|
||||||
cp -v ./bin/autojump.bash ${destdir}etc/profile.d/ || exit 1
|
cp -v ./bin/autojump.bash ${destdir}etc/profile.d/ || exit 1
|
||||||
cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/ || exit 1
|
cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/ || exit 1
|
||||||
|
mkdir -p ${destdir}${zshsharedir} || exit 1
|
||||||
|
# TODO: remove unused _j function (2013.02.01_1348, ting)
|
||||||
|
install -v -m 0755 ./bin/_j ${destdir}${zshsharedir} || exit 1
|
||||||
|
|
||||||
# MODIFY AUTOJUMP.SH FOR CUSTOM INSTALLS
|
# MODIFY AUTOJUMP.SH FOR CUSTOM INSTALLS
|
||||||
if [[ -z ${local} ]] && [[ -z ${global} ]]; then
|
if [[ -z ${local} ]] && [[ -z ${global} ]]; then
|
||||||
|
@ -65,7 +65,14 @@ if [ -d "${prefix}/share/autojump/" ]; then
|
|||||||
|
|
||||||
if [ -f /etc/profile.d/autojump.zsh ]; then
|
if [ -f /etc/profile.d/autojump.zsh ]; then
|
||||||
sudo rm -v /etc/profile.d/autojump.zsh
|
sudo rm -v /etc/profile.d/autojump.zsh
|
||||||
|
|
||||||
fpath=`/usr/bin/env zsh -c 'echo $fpath'`
|
fpath=`/usr/bin/env zsh -c 'echo $fpath'`
|
||||||
|
for f in ${fpath}; do
|
||||||
|
if [[ -f ${f}/_j ]]; then
|
||||||
|
sudo rm -v ${f}/_j
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
remove_msg "global" "zsh"
|
remove_msg "global" "zsh"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user