From 3d4f8a4d4f21d8391fa955257a2a1112661bfba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Schaerer?= Date: Wed, 18 Feb 2009 14:55:50 +0100 Subject: [PATCH] fix for directories with spaces --- autojump | 2 +- autojump.sh | 2 +- autojump_completion | 20 +------------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/autojump b/autojump index ad7d667..f0114bc 100755 --- a/autojump +++ b/autojump @@ -108,6 +108,6 @@ else: if userchoice!=-1: if len(results) > userchoice-1 : print results[userchoice-1] elif len(results) > 1 and completion: - print " ".join(("%s__%d__%s" % (pattern,n+1,r) for n,r in enumerate(results[:8]))) + print "\n".join(("%s__%d__%s" % (pattern,n+1,r) for n,r in enumerate(results[:8]))) else: if results : print results[0] diff --git a/autojump.sh b/autojump.sh index 59d2f5c..81ec11f 100755 --- a/autojump.sh +++ b/autojump.sh @@ -3,5 +3,5 @@ if [ $SHELL = "/bin/bash" ] && [ -n "$PS1" ]; then export PROMPT_COMMAND='autojump -a "$(pwd -P)";'"$PROMPT_COMMAND" alias jumpstat="autojump --stat" - function j { new_path=$(autojump $@);if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; echo; cd "$new_path";fi } + function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; echo; cd "$new_path";fi } fi diff --git a/autojump_completion b/autojump_completion index a7d81f0..e3dd1a5 100644 --- a/autojump_completion +++ b/autojump_completion @@ -5,27 +5,9 @@ _autojump() { local cur - COMPREPLY=() cur=${COMP_WORDS[1]} - COMPREPLY=($(autojump --completion "$cur")) - -# case "$cur" in -# -*) -# COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \ -# -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \ -# -tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ) ) -# ;; -# *) -# if [ $COMP_CWORD -eq 1 ]; then -# COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- $cur ) ) -# else -# _filedir '@(rar|RAR)' -# fi -# ;; -# esac - + IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --completion "$cur") return 0 - } complete -F _autojump j