Pass autocomplete only works directly after installing oh-my-zsh

TLDR: Auto-complete only works directly after installing oh-my-zsh. If I close and re-open the terminal, auto-complete no longer works.

I'm running MacOS BigSur M1. I'm using the Unix Pass manager, which is used with the pass command. The autocomplete bundled with oh-my-zsh doesn't seem to be working properly.

Here's what I'm doing.

  1. Open terminal (Hyper, iTerm, whatever; doesn't seem to matter).
  2. Install Zsh.
  3. Install Oh-My-Zsh.
  4. At the point, pass auto complete is working fine. So pass + TAB will list my password options.
  5. If I close the terminal and then open it back up again, the auto complete no longer works.

I can uninstall oh-my-zsh with uninstall_oh_my_zsh, reinstall it with the sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)", close the terminal, and then reopen it again, and pass autocomplete works again! But then as soon as I close that terminal window, I'll lose the autocomplete.

I've no idea how to even start degugging this. I'm not sure if it's an issue with my installation of ZSH, or something to do with MacOS?

I originally posted this issue on the Discussion tab in the Oh-my-zsh GitHub repo a couple weeks ago, but it hasn't gotten any answers. It looks like this problem could be similar to another one posted here, but it hasn't received any answers.


The post Autocomplete in zsh (with oh-my-zsh) not working #353 terminates with the following summary:

I'm not going to pretend to know anything about compinit, but some experimentation has shown that running it clobbers any auto completion that has already been configured. This coupled with tons of recommendations on the web to run it to "fix" autocompletion issues appears to have led to multiple projects including it in their auto completion initialization files (two that I use: nvm and sdkman appear to have done so) -- which results in the latest one to load clobbering the configuration of all those before it!

The author then added the following lines to .zshrc, which fixed the problem for him and others:

autoload -Uz compinit
compinit -u

# It seems that countless recommendations on the web to run:
# autoload -Uz compinit && compinit
    
# Have resulted in everyone's zsh autocomplete initialization running that. I have no idea
# what it does, however experimentation has shown that running "compinit" clobbers any
# completions you already had configured. Which totally sucks if you configure auto completion
# for multiple tools in your zshrc

alias compinit="echo no more compinit!"