tarjoilija / zgen

A lightweight and simple plugin manager for ZSH
BSD 2-Clause "Simplified" License
1.49k stars 98 forks source link

Errors occurred when using oh-my-zsh and prezto together #111

Closed laggardkernel closed 4 years ago

laggardkernel commented 5 years ago

I'm migrating from prezto, so I enabled all the prezto modules I use, and cherrypicked the plugin gitignore from oh-my-zsh.

zgen prezto
...

zgen oh-my-zsh
zgen oh-my-zsh plugins/gitignore

It seems that both of prezto and oh-my-zsh depend on the variable ZSH, but only one is set in ~.zgen/init.zsh. (Did a search about this variable ZSH in prezto, it's not needed at all.)

And when zgen prezto is enable, the variable ZSH is always set for prezto but not oh-my-zsh. In my case, it's set ZSH=~/.zgen/sorin-ionescu/prezto-master. This caused an error for oh-my-zsh, to be specific, for zgen oh-my-zsh only. Disable zgen oh-my-zsh and only enable zgen oh-my-zsh plugins/gitignore, this works well without an error.

Seeing from the error,

zsh: can't open input file: /Users/<my-user-name>/.zgen/sorin-ionescu/prezto-master/tools/check_for_upgrade.sh
/Users/<my-user-name>/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh:34: no matches found: /Users/<my-user-name>/.zgen/sorin-ionescu/prezto-master/lib/*.zsh

ZSH variable is used in initial script in oh-my-zsh.sh. It should be set as ZSH=${HOME}/.zgen/robbyrussell/oh-my-zsh-master for oh-my-zsh.

ZSH in prezto is not needed. Prezto doesn't use this variable at all. Some submodules included by prezto use ZSH in its test, which will not be used by ordinary users but by the developer for a test.

laggardkernel commented 5 years ago

Sorry, after some tests, I find that prompt module from prezto depends on thie variable ZSH indirectly.

Besides, source "/Users/<username>/.zgen/sorin-ionescu/prezto-master/init.zsh" should be put after source "/Users/<username>/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh", which could be achieved by putting zgen prezto after zgen oh-my-zsh.

Or the prompt couldn't display as expected.

tekumara commented 4 years ago

I have zgen prezto after zgen oh-my-zsh and have this issue:

/Users/tekumara/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh:source:65: no such file or directory: /Users/tekumara/.zgen/sorin-ionescu/prezto-master/lib/compfix.zsh
/Users/tekumara/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh:67: command not found: handle_completion_insecurities
/Users/tekumara/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh:78: no matches found: /Users/tekumara/.zgen/sorin-ionescu/prezto-master/lib/*.zsh
tekumara commented 4 years ago

In fact, I get the same result when they are in the opposite order too.

laggardkernel commented 4 years ago

Closed because of inactivity.

ijcd commented 3 years ago

Closed without a fix? I am seeing this as well.

ijcd commented 3 years ago

This was the problem for me:

% cat ~/.zgen/init.zsh
# {{{
# Generated by zgen.
# This file will be overwritten the next time you run zgen save!

ZSH=/Users/ijcd/.zgen/sorin-ionescu/prezto-master

# ### Prezto initialization

# ### General modules
source "/Users/ijcd/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh"

The init.zsh file was getting ZSH set to prezto-master. I fixed this by using a custom load module:

override_zsh_location.zsh

ZSH=${HOME}/.zgen/robbyrussell/oh-my-zsh-master

And doing the init like so:

zgen load "${DOTDIR}/local/boot/override_zsh_location.zsh"

zgen oh-my-zsh
zgen prezto

This is producing a workable init.zsh, even if it is a hack.

# {{{
# Generated by zgen.
# This file will be overwritten the next time you run zgen save!

ZSH=/Users/ijcd/.zgen/sorin-ionescu/prezto-master

# ### Prezto initialization

# ### General modules
source "/Users/ijcd/.dotfiles/local/boot/override_zsh_location.zsh"
source "/Users/ijcd/.zgen/robbyrussell/oh-my-zsh-master/oh-my-zsh.sh"

I haven't come across an issue where prezto is unhappy because ZSH is set this way, but maybe soon I will...