ohmyzsh: New z plugin does not work by placing it into ~/.zshrc → plugins=(... z) array

Describe the bug

At this moment oh-my-zsh plugin docs saying that any plugin listed is enabled by listing it in plugins=(...) array.

Doing so with new version of z causes:

zsh: command not found: z

Steps to reproduce

  1. Upgrade to latest oh-my-zsh
  2. in .zshrc put z into plugins array
  3. reload terminal
  4. navigate with z
  5. zsh: command not found: z

Expected behavior

I expect z to work once placed into plugins array.

Screenshots and recordings

My .zshrc:

# Oh My Zsh
export ZSH=$HOME/.oh-my-zsh # Path to oh-my-zsh installation.
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST # Store zsh's completion cache inside oh-my-zsh cache folder

# Oh My Zsh config variables
ZSH_THEME=half-life
ENABLE_CORRECTION=true
ZSH_CUSTOM=~/.config/oh-my-zsh-custom # my oh-my-zsh customization folder. contains aliases, functions, plugins, etc.

plugins=(z)

# Init Oh My Zsh after its config variables are set
source $ZSH/oh-my-zsh.sh

OS / Linux distribution

MacOS Monterey 12.6 (21G115)

Zsh version

5.9

Oh My Zsh version

master (0066280)

Terminal emulator

iTerm2

Additional context

agkozak version of z installation section mentions to use a plugin manager to install it. So plugins approach won’t work with it and to install new z a plugin manager needs to be used?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

You have a custom aliases.zsh file that deletes all aliases:

alias ${ZSHZ_CMD:-${_Z_CMD:-z}}='zshz 2>&1'
+/Users/furthur/.oh-my-zsh/plugins/z/z.plugin.zsh:845> alias 'z=zshz 2>&1'
...
# Delete all built-in aliases: system and oh-my-zsh
unalias -m '*'
+/Users/furthur/.config/oh-my-zsh-custom/aliases.zsh:2> unalias -m '*'

Without aliases, there is no alias named z, which is how the plugin works.

You can set alias 'z=zshz 2>&1' in the oh-my-zsh-custom/aliases.zsh file if you still want to keep the unalias -m '*' line.