From eae871da9ae8110e290b14f27e36c13b99889b10 Mon Sep 17 00:00:00 2001 From: Khalid Zubair Date: Thu, 9 Feb 2012 23:13:32 -0500 Subject: [PATCH 1/4] Add option to preserve paths with symlinks; Add a second command 's' to jump to a subdirectory --- autojump | 2 +- autojump.bash | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/autojump b/autojump index 77f8b04..dbd9377 100755 --- a/autojump +++ b/autojump @@ -28,7 +28,7 @@ from operator import itemgetter import os import shutil -AUTOJUMP_VERSION = "release-v19" +AUTOJUMP_VERSION = "release-v19-49-g8e86f08-dirty" MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 600 COMPLETION_SEPARATOR = '__' diff --git a/autojump.bash b/autojump.bash index 914c374..f97a457 100644 --- a/autojump.bash +++ b/autojump.bash @@ -66,7 +66,13 @@ if [ -d ~/.autojump/ ]; then fi export AUTOJUMP_HOME=${HOME} -AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null' +if [ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ] +then + _PWD_ARGS="" +else + _PWD_ARGS="-P" +fi +AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>"${AUTOJUMP_DATA_DIR}/.autojump_errors";} 2>/dev/null' case $PROMPT_COMMAND in *autojump*) ;; @@ -75,3 +81,5 @@ esac 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";else false; fi } +function s { j $PWD $@ ; } + From 123afc5f3745df06bf772821ba0d906f9e07fa79 Mon Sep 17 00:00:00 2001 From: Khalid Zubair Date: Fri, 10 Feb 2012 19:17:55 -0500 Subject: [PATCH 2/4] remove the 's' shortcut, revert change to autojump version --- autojump | 2 +- autojump.bash | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/autojump b/autojump index dbd9377..77f8b04 100755 --- a/autojump +++ b/autojump @@ -28,7 +28,7 @@ from operator import itemgetter import os import shutil -AUTOJUMP_VERSION = "release-v19-49-g8e86f08-dirty" +AUTOJUMP_VERSION = "release-v19" MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 600 COMPLETION_SEPARATOR = '__' diff --git a/autojump.bash b/autojump.bash index f97a457..1e568ce 100644 --- a/autojump.bash +++ b/autojump.bash @@ -81,5 +81,3 @@ esac 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";else false; fi } -function s { j $PWD $@ ; } - From a5a135d2b52f541c35ca55f4ce8cbbad5bf4658b Mon Sep 17 00:00:00 2001 From: Khalid Zubair Date: Fri, 10 Feb 2012 19:37:56 -0500 Subject: [PATCH 3/4] Add option to preserve symlinks to the zsh script --- autojump.bash | 1 + autojump.zsh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/autojump.bash b/autojump.bash index 1e568ce..e1b9685 100644 --- a/autojump.bash +++ b/autojump.bash @@ -81,3 +81,4 @@ esac 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";else false; fi } + diff --git a/autojump.zsh b/autojump.zsh index b9fa085..3ae80b2 100644 --- a/autojump.zsh +++ b/autojump.zsh @@ -35,6 +35,12 @@ if [[ -d ~/.autojump/ ]]; then fi function autojump_preexec() { + if [[ "${AUTOJUMP_KEEP_SYMLINKS}" == "1" ]] + then + _PWD_ARGS="" + else + _PWD_ARGS="-P" + fi { (autojump -a "$(pwd -P)"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null } From f0fe603af54424ca282a9409c6521ce379a89f17 Mon Sep 17 00:00:00 2001 From: Khalid Zubair Date: Fri, 10 Feb 2012 19:41:17 -0500 Subject: [PATCH 4/4] Add option to preserve symlinks to the zsh script --- autojump.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autojump.zsh b/autojump.zsh index 3ae80b2..83dde8a 100644 --- a/autojump.zsh +++ b/autojump.zsh @@ -41,7 +41,7 @@ function autojump_preexec() { else _PWD_ARGS="-P" fi - { (autojump -a "$(pwd -P)"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null + { (autojump -a "$(pwd ${_PWD_ARGS})"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/.autojump_errors ; } 2>/dev/null } typeset -ga preexec_functions