Autojump: zsh completion

Created on 8 Feb 2013  ·  16Comments  ·  Source: wting/autojump

Hi there,
just today I started out using zsh, and I also started porting my config from bash to zsh. I managed to have the j alias defined, but not the autocompletion.
I can see for bash the settings for autojump completion here https://github.com/joelthelion/autojump/blob/master/bin/autojump.bash#L13 but I cannot see any zsh specific settings for autocompletion in here https://github.com/joelthelion/autojump/blob/master/bin/autojump.zsh
Is this a bug or am I doing it wrong?

bug

Most helpful comment

You need to add the autoload -U compinit && compinit line after loading autojump to get zsh tab completion working.

All 16 comments

Sorry it's kind of buried in the documentation, but zsh autocompletion requires additional configuration.

I added that but j<space><tab><tab> only completes the filenames in current dir

It may be a bug. I don't have time right now but I'll look into it further when I can.

cool, thanks

Same issue here, on Mac 10.7.5 running zsh 4.3.11. I can't get autocompletion working. I tried using the oh-my-zsh plugin, and a plain manual installation. I also tried putting ~/.autojump/bin on the path. Nothing helped.
Autojump itself works (e.g. "j src"), but tab-completion does not. It just shows the files of the current directory.

Anyway, let me express my deep gratitude for all your development work! I very much would have liked to come up with a solution rather than just a complaint, but I were not able to fix this...

You need to add the autoload -U compinit && compinit line after loading autojump to get zsh tab completion working.

Thanks for investigation, but this does not seem to make a difference for me. I removed all other entries from .zshrc, .zshenv and .zprofile, to get a plain zsh, and then run source .autojump/etc/profile.d/autojump.zsh and autoload -U compinit && compinit. Still the same behaviour: autojump works, but no tab completion.

grota, can you test on your machine?

Sure, I'll try later, but IIRC I tried launching that command from the prompt and it didn't work. I'll post the confirmation later.

Confirmed, it doesn't work. @wting is it possible that the autocomplete functionality was implemented by the _j file that was recently deleted?

Possibly, but when I rolled back and installed that version I didn't get tab completion back.

I just updated my zsh from version 4.3.11 (preinstalled) to 5.0.2 (via macports). In that version, everything works as expected. So maybe we should just add this hint somewhere and leave it at that?

I just compiled, installed and run zsh 5.0.0 from source but I didn't get the autocomplete

Ok, it should work for sure now. T_T

yep, thanks!

I had the same problem described here with zsh 5.0.0 (from Ubuntu 12.10), tried the solution with adding compinit. But I also needed to add ~/.autojump to fpath to get the completion working:

fpath=( ~/.autojump "${fpath[@]}" ) # do before sourcing autojump
Was this page helpful?
0 / 5 - 0 ratings