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

this is already something...

This commit is contained in:
Joel Schaerer 2009-02-14 00:51:07 +01:00
parent d5a7c0579a
commit 4b64944832
3 changed files with 33 additions and 2 deletions

View File

@ -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

View File

@ -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

31
autojump_completion Normal file
View File

@ -0,0 +1,31 @@
# unrar(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr>
#
# $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