zpm-zsh/zpm

zpm load @omz doesn't appear to actually initialise OMZ

novirium opened this issue · 3 comments

In a recent change to the Readme, ZPM suggests to run zpm load @omz before loading any OMZ plugins or themes. I was assuming this is intended to source the root oh-my-zsh.sh file in the OMZ repository, which does some setup and loads all the framework libraries. This doesn't appear to work at the moment though - turning on debugging and running zpm load @omz after cleaning zpm shows:

zpm:init Initialize '@omz'
zpm:init:source Plugin file for @omz is missing

Trying to do this manually with zpm load @omz,source:oh-my-zsh.sh does work the first time, but when the cached version tries to run next time I open the shell there's messiness with the $ZSH variable pointing to the ZPM cache, so it can't find files from the OMZ repository like lib/compfix.zsh

I'm currently getting around most of this successfully just by manually loading all of the individual OMZ libraries I need instead:

zpm load                        \
  @omz-lib/compfix              \
  @omz-lib/completion           \
  @omz-lib/directories          \
  @omz-lib/functions            \
  @omz-lib/git                  \
  @omz-lib/grep                 \
  @omz-lib/history              \
  @omz-lib/key-bindings         \
  @omz-lib/misc                 \
  @omz-lib/nvm                  \
  @omz-lib/spectrum             \
  @omz-lib/theme-and-appearance

What is the recommended way to get OMZ plugins running via ZPM?

Hi @novirium. The main problem is that ohmyzsh and zpm are package managers, so theoretically you don't need ohmyzsh if you use zpm. But ohmyzsh has a large list of integrate plugins, so I can't ignore it. Any omz plugin, theme or file form lib/ dir can be loaded by zpm, but not ohmyzsh itself. @omz is used only for installation/upgrade of core ohmyzsh repo, and nothing else. If you want to use an omz plugin, but it doesn't work correctly, try to load some omz libs before(usually @omz-lib/git).

Gotcha 👍. So the comment in the readme about making sure to add zpm load @omz before using any of the OMZ plugins, libraries or themes is just to make sure there is actually a git clone of the OMZ git repo there for any of the plugin types starting with @omz* to reference?

I guess the zpm load @omz bit had me confused, as load usually tries to source things by default, and is relying on there not being a suitable file to source in the root OMZ repo. Ironically this actually achieves what I had wanted - using some OMZ plugins without running all of the OMZ framework init stuff.

For future reference, the suggested way to load OMZ plugins and themes would then be like this?

# Pull in OMZ (doesn't actually source anything)
zpm load @omz

# Load any OMZ libraries we want or our OMZ plugins require
zpm load                \
  @omz-lib/compfix      \
  @omz-lib/completion   \
  @omz-lib/directories  \
  @omz-lib/functions    \
  @omz-lib/git          \
  @omz-lib/grep         \
  @omz-lib/history      \
  @omz-lib/key-bindings \
  @omz-lib/misc         \
  @omz-lib/spectrum     \
  @omz-lib/theme-and-appearance

# Load some OMZ plugins and theme
zpm load          \
  @omz/virtualenv \
  @omz/git

zpm load @omz-theme/robbyrussell

For future reference, the suggested way to load OMZ plugins and themes would then be like this?

Yes, you are absolutely right. You understood me correctly. I will change the README to avoid such misunderstandings.