1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

small changes

This commit is contained in:
Joel Schaerer 2009-02-14 00:39:54 +01:00
parent d4eae3ef98
commit 3ff9135aa1
2 changed files with 6 additions and 4 deletions

View File

@ -81,7 +81,8 @@ else:
print path print path
found=True found=True
break 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=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) dirs.sort(key=lambda e:e[1],reverse=True)
if not found: if not found:
@ -90,9 +91,10 @@ else:
if not completion: if not completion:
print path print path
break break
else: uniqadd(results,path) else:
uniqadd(results,path)
if completion: 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) cPickle.dump(path_dict,open(dic_file+".tmp",'w'),-1)
import shutil import shutil
shutil.copy(dic_file+".tmp",dic_file) #cPickle.dump doesn't seem to be atomic, so this is more secure shutil.copy(dic_file+".tmp",dic_file) #cPickle.dump doesn't seem to be atomic, so this is more secure

View File

@ -1,5 +1,5 @@
if [ $SHELL = "/bin/bash" ]; then if [ $SHELL = "/bin/bash" ]; then
export PROMPT_COMMAND='autojump -a "$(pwd -P)";'"$PROMPT_COMMAND" export PROMPT_COMMAND='autojump -a "$(pwd -P)";'"$PROMPT_COMMAND"
alias jumpstat="autojump --stat" 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 fi