Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

command not found: complete

I have a fresh mac in front of me, I installed homebrew (just fine), and oh my zsh (just fine).

I'm trying to install autojump which is a intelligent database of directories. For example, you can 'jump' to ~/Documents with j doc in terminal.

I did this

brew install autojump

I already have my .zshrc that looks fine I think. I added the line into it that it said:

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

When I start iterm2 I get the following warning:

/usr/local/Cellar/autojump/21.3.0/etc/autojump.bash:13: command not found: complete
/usr/local/Cellar/autojump/21.3.0/etc/autojump.bash:55: = not found

I have used brew to install other things, and I can run autojump -s successfully so I know it is seeing the $path. I don't know what else could be wrong though, as this is all a fresh install.

like image 447
st0rk Avatar asked Jan 18 '13 23:01

st0rk


People also ask

How do I complete a command in Linux?

When at the MS-DOS, Windows command line or a Linux or Unix shell, typing in long file names or directories can become a burden. Use the Tab to autocomplete the names of directories and files while in the command line.

Does bash completion work with zsh?

for ZSH usersZsh can handle bash completions functions. The latest development version of zsh has a function bashcompinit, that when run will allow zsh to read bash completion specifications and functions.


2 Answers

In your .zshrc, you must source autojump.zsh, not autojump.bash (I do not know where it will be located on a Mac, but it will be in same folder as autojump.bash).

On Ubuntu, here is what you need to append at the end of your .zshrc:

source /usr/share/autojump/autojump.zsh
like image 72
ebrehault Avatar answered Sep 24 '22 14:09

ebrehault


To fix the problem, you should update the line:

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

to say:

[[ -s `brew --prefix`/etc/autojump.zsh ]] && . `brew --prefix`/etc/autojump.zsh

i.e. use the .zsh version of the autojump script. That fixed it for me.

like image 41
Amelio Vazquez-Reina Avatar answered Sep 21 '22 14:09

Amelio Vazquez-Reina