From 0ec15907e3f63ef09182a8d183832bc26356270c Mon Sep 17 00:00:00 2001 From: Joel Schaerer Date: Sat, 3 Oct 2009 20:25:16 +0200 Subject: [PATCH] fixes for zsh. Thanks simon!!! --- _j | 10 +++------- autojump | 4 ++-- autojump.bash | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/_j b/_j index b5629b4..8c3279b 100644 --- a/_j +++ b/_j @@ -18,10 +18,6 @@ cur=${words[2, -1]} -ret=$(autojump --completion "${cur[*]}") - -if [ "$ret" != "" ]; then # if at least one answer - for i in $(echo "$ret"); do - compadd -U $i # add all of them as possible completion - done -fi +autojump --completion ${cur[*]} | while read i; do + compadd -U $i; +done diff --git a/autojump b/autojump index 5d17c4c..18ca13d 100755 --- a/autojump +++ b/autojump @@ -93,7 +93,7 @@ def open_dic(dic_file,error_recovery=False): #Main code try: - optlist, args = getopt.getopt(argv[1:], 'a',['stat','import','completion']) + optlist, args = getopt.getopt(argv[1:], 'a',['stat','import','completion', 'bash']) except getopt.GetoptError, e: print "Unknown command line argument: %s" % e exit(1) @@ -147,7 +147,7 @@ else: if dead_dirs and not completion: #save the dict if there were some non-existent directories in the database save(path_dict,dic_file) - if completion: quotes='"' + if completion and ('--bash', '') in optlist: quotes='"' else: quotes="" if userchoice!=-1: diff --git a/autojump.bash b/autojump.bash index 988f38d..56f5c2b 100644 --- a/autojump.bash +++ b/autojump.bash @@ -21,7 +21,7 @@ _autojump() COMPREPLY=() unset COMP_WORDS[0] #remove "j" from the array cur=${COMP_WORDS[*]} - IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --completion "$cur") + IFS=$'\n' read -d '' -a COMPREPLY < <(autojump --bash --completion "$cur") return 0 } complete -F _autojump j