From d57e7b779c05215f32228ec681c79c169202002d Mon Sep 17 00:00:00 2001 From: William Ting Date: Fri, 1 Feb 2013 13:50:52 -0600 Subject: [PATCH] add option to open file explorer window from the commandline, bump to 21.4.0 --- README.md | 2 +- bin/autojump | 2 +- bin/autojump.bash | 25 +++++++++++++++++++++++++ bin/autojump.zsh | 28 ++++++++++++++++++++++++++++ install.sh | 1 + 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3d24eb3..08e0ee2 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Grab a copy of autojump: Run the installation script: cd autojump - ./install.sh [ --local ] [ --zsh ] + ./install.sh [ --local ] and follow on screen instructions. diff --git a/bin/autojump b/bin/autojump index f081dbb..059eb6c 100755 --- a/bin/autojump +++ b/bin/autojump @@ -34,7 +34,7 @@ import re import shutil from tempfile import NamedTemporaryFile -VERSION = 'release-v21.3.0' +VERSION = 'release-v21.4.0' MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 1000 COMPLETION_SEPARATOR = '__' diff --git a/bin/autojump.bash b/bin/autojump.bash index 83c35cf..cbd7004 100644 --- a/bin/autojump.bash +++ b/bin/autojump.bash @@ -93,3 +93,28 @@ function jc { j $(pwd) ${@} fi } + +function jo { + case ${OSTYPE} in + linux-gnu) + xdg-open $(autojump $@) + ;; + darwin*) + open $(autojump $@) + ;; + cygwin) + cmd /C start "" $(cygpath -w -a $(pwd)) + ;; + *) + echo "Unknown operating system." 1>&2 + ;; + esac +} + +function jco { + if [[ ${@} == -* ]]; then + j ${@} + else + jo $(pwd) ${@} + fi +} diff --git a/bin/autojump.zsh b/bin/autojump.zsh index 4eea620..4e28f9b 100644 --- a/bin/autojump.zsh +++ b/bin/autojump.zsh @@ -23,6 +23,7 @@ command -v brew &>/dev/null \ && [[ -d "`brew --prefix`/share/zsh/site-functions" ]] \ && fpath=(`brew --prefix`/share/zsh/site-functions ${fpath}) +# TODO: switch this to a chpwd hook instead (2013.02.01_1319, ting) function autojump_preexec() { if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]]; then _PWD_ARGS="" @@ -37,6 +38,7 @@ preexec_functions+=autojump_preexec function j { # Cannot use =~ due to MacPorts zsh v4.2, see issue #125. + echo "j()" if [[ ${@} == -* ]]; then autojump ${@} return @@ -54,9 +56,35 @@ function j { } function jc { + echo "j()" if [[ ${@} == -* ]]; then j ${@} else j $(pwd) ${@} fi } + +function jo { + case ${OSTYPE} in + linux-gnu) + xdg-open $(autojump $@) + ;; + darwin*) + open $(autojump $@) + ;; + cygwin) + cmd /C start "" $(cygpath -w -a $(pwd)) + ;; + *) + echo "Unknown operating system." 1>&2 + ;; + esac +} + +function jco { + if [[ ${@} == -* ]]; then + j ${@} + else + jo $(pwd) ${@} + fi +} diff --git a/install.sh b/install.sh index f0a1065..498031c 100755 --- a/install.sh +++ b/install.sh @@ -217,6 +217,7 @@ 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.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