From 3ff9135aa11288d7634fe7d3afd57ffdda917cd3 Mon Sep 17 00:00:00 2001 From: Joel Schaerer Date: Sat, 14 Feb 2009 00:39:54 +0100 Subject: [PATCH] small changes --- autojump | 8 +++++--- autojump.sh | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/autojump b/autojump index b092a76..cee0a04 100755 --- a/autojump +++ b/autojump @@ -81,7 +81,8 @@ else: print path found=True break - else: uniqadd(results,path) + else: + uniqadd(results,path) dirs=path_dict.items() #we need to recreate the list since the first iteration potentially deletes paths dirs.sort(key=lambda e:e[1],reverse=True) if not found: @@ -90,9 +91,10 @@ else: if not completion: print path break - else: uniqadd(results,path) + else: + uniqadd(results,path) if completion: - print " ".join(results) + print " ".join(("%.4d)_%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 adea395..a23e1d8 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 $@);if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; echo; cd "$new_path";fi } + 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 } fi