diff --git a/autojump b/autojump index 4e632a2..6e727f5 100755 --- a/autojump +++ b/autojump @@ -94,7 +94,7 @@ else: else: uniqadd(results,path) if completion: - print " ".join(("%.4d)_%s" % (n,r) for n,r in enumerate(results))) + print " ".join(("%d)%s" % (n,r) for n,r in enumerate(results))) cPickle.dump(path_dict,open(dic_file+".tmp",'w'),-1) import shutil shutil.copy(dic_file+".tmp",dic_file) #cPickle.dump doesn't seem to be atomic, so this is more secure diff --git a/autojump.sh b/autojump.sh index a23e1d8..adea395 100644 --- a/autojump.sh +++ b/autojump.sh @@ -1,5 +1,5 @@ if [ $SHELL = "/bin/bash" ]; then export PROMPT_COMMAND='autojump -a "$(pwd -P)";'"$PROMPT_COMMAND" alias jumpstat="autojump --stat" - function j { new_path=$(autojump $@ | sed 's/.*)_//');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 new file mode 100644 index 0000000..a7d81f0 --- /dev/null +++ b/autojump_completion @@ -0,0 +1,31 @@ +# unrar(1) completion by Guillaume Rousse +# +# $Id: unrar,v 1.4 2004/07/05 23:37:47 ianmacd Exp $ + +_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 + + return 0 + +} +complete -F _autojump j