Open xavistp opened 8 years ago
Yes this problem still persists but I'm not completely sure what causes it.
I'm leaning towards the option 2 since it makes things simpler. This also means that zgen-apply
is no longer needed because you can source the init script at the end of zgen-save
.
Does this make debugging faulty configurations a bit harder though? You've basically already generated the static init script and trying to source it as a whole. Is there any benefit for sourcing plugins one by one during the initial setup?
I am having an issue with this as well. The problem is I am running into is that I cannot override aliases or functions defined in prezto modules with my own aliases defined in custom plugins. My own custom aliases will be loaded when the init.zsh is initially built, because Zgen sources them in a different order than when sourcing the generated file.
I believe this is caused by putting the calls to pmodload
after the General modules
section in the init.zsh script.
The fix would be to order the output in the init.zsh file like this:
# ### General modules
source "/Users/username/.zgen/sorin-ionescu/prezto-master/init.zsh"
# ### Prezto modules
pmodload 'environment' 'terminal' 'editor' 'history' 'directory' 'spectrum' 'utility' 'completion' 'prompt' 'history-substring-search'
source "/Users/username/.zgen/other-module/other-module/init.zsh"
...
Unfortunately, that solution requires special handling of the Prezto plugin and it's not immediately apparent how I could do that in a non-terrible way. I do think it would be preferable if Zgen would respect the order in which I define my plugins to help with debugging and keeping with a principle-of-least-surprise.
I don't have time at the moment to try to fix this, but I can investigate how to do this in a sane way and whip up a PR if there is interest in pursuing this path.
I was able to work around the issue by setting export ZGEN_PREZTO_LOAD_DEFAULT=0
, and loading any Prezto modules with the zgen load sorin-ionescu/prezto modules/[MODULE]
syntax. This prevents Zgen from generating the calls to pmodload
. Generating my init.zsh file is now deliciously deterministic.
@xavistp this may fix your issue. Here is a gist of my .zshrc file: https://gist.github.com/brandon-fryslie/60339a0fc1f78aef6249809ea68c5f74
My above solution has some problems of its own, namely that without pmodload, functions from prezto modules (in 'functions' dir) aren't loaded properly. This became a big enough issue for me that I fixed it: https://github.com/tarjoilija/zgen/pull/87
The change is here on my fork: https://github.com/brandon-fryslie/zgen
@tarjoilija, thanks for your great work. Your project is fantastic. I hope we can find a way to merge my PR so I don't have to maintain a fork.
Hi, first of all thanks for zgen, moving from antigen and then from oh-my-zsh to prezto was super easy and now everything is faster.
My custom prezto prompt is not loading when the static init script is not generated. I think it is because, when generating the script, prezto and the modules are loaded in place, while the fpath is not modified until the end after generating the script. I can workaround this by modifying fpath myself, but I'd love to keep it clean and just use zgen load.
I guess there are 2 possible solutions:
-zgen-add-to-fpath
and then it's not necessary to do it inzgen-apply
Let me know what you think.