-
Notifications
You must be signed in to change notification settings - Fork 16
Issues
Behavior with no options.
Some people seem to want j with no options to behave like cd, (ie go to ~
). I’m of the opinion that having it print out the dir list is more useful, as cd is firmly in muscle memory, j --l
is annoying to type, and the list is useful for reference.
What i’ve done is alias jl='j --l'
and it works pretty well. Feedback and reasoning for wanting other behavior is welcome, though.
Completion behavior
Tab completion works like this: j a b c<TAB>
will complete on items that contain a
, b
, AND c
out of the .j
file. Hit enter and the first two arguments should be ignored.
By default, tab completes up to where a path stops being unique, and then beeps – a couple more tabs will show a list of completions. You might prefer to have tab cycle through multiple completions, by putting
bind '"\t":menu-complete'
Speed
The part that runs during PROMPT_COMMAND should be as fast as possible. I ran some crappy benchmarks between this script and autojump, piping a file containing about 200 uniq dirs, each listed 10 times into the PROMPT_COMMAND part 4 times for each one. Assuming this a reasonable benchmark, j seems to have a slight edge:
~$ time for x in $(cat input); do ./aj.py -a "$x";done real 1m8.753s user 0m46.907s sys 0m19.745s ~$ time for x in $(cat input); do ./aj.py -a "$x";done real 1m9.950s user 0m47.715s sys 0m19.973s ~$ time for x in $(cat input); do ./aj.py -a "$x";done real 1m9.860s user 0m48.127s sys 0m20.537s ~$ time for x in $(cat input); do ./aj.py -a "$x";done real 1m11.415s user 0m48.919s sys 0m20.673s ~$ time for x in $(cat input); do ./j.sh --add "$x";done real 0m57.965s user 0m27.226s sys 0m28.994s ~$ time for x in $(cat input); do ./j.sh --add "$x";done real 0m58.909s user 0m27.206s sys 0m28.974s ~$ time for x in $(cat input); do ./j.sh --add "$x";done real 1m0.295s user 0m27.330s sys 0m30.398s ~$ time for x in $(cat input); do ./j.sh --add "$x";done real 1m1.141s user 0m28.046s sys 0m30.098s