Description
Environment
Ubuntu 24.04 on Windows 10 WSL using zsh 5.9 with Oh My Zsh plus ZBrowse and ZUI plugins
Reproduction steps
- Install ZBrowse to the OMZ custom plugins directory per the ZBrowse installation isntructions for OMZ
- Install ZUI to the OMZ custom plugins directory according to the ZUI installation isntructions for OMZ
- Add
zbrowse
andzui
to OMZ's plugins array in.zshrc
- Reload the shell or run
omz reload
- Press
crtl+b
to launch ZBrowse
Note: I tested this with AND without other OMZ plugins being loaded and the behaviour was the same.
Expected behavior
- pressing ctrl+b will launch ZBrowse
Current behavior
Pressing ctrl+b
to launch ZBrowse results in the following error:
zbrowse:482: zui-event-loop: function definition file not found
Code snippet
From .zshrc
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
zui
zbrowse
)
Additional information
First of all, I realize this may very well be an issue with Oh My Zsh. If that is the case, please let me know and I will go there for resolution. I am not a zsh expert and my experience is limited to using it as my shell with OMZ.
Workaround:
A workaround for this issue is to load ZUI directly, per the Standalone installation instuctions. Placing
source {where-zui-is}/zui.plugin.zsh
in my .zshrc
file yields a successful result.
Details:
When loading ZUI as a plugin via OMZ, ZUI's functions directory ($ZUI_REPO_DIR/functions
) is not added to the fpath
array.
The failure appears to happen due to the following code block (zui.plugin.zsh
lines 26-31):
# Update FPATH if:
# 1. Not loading with ZI
# 2. Not having fpath already updated (that would equal: using other plugin manager)
if [[ -z "$ZI_CUR_PLUGIN" && "${fpath[(r)$ZUI_REPO_DIR]}" != $ZUI_REPO_DIR ]]; then
fpath+=( "$ZUI_REPO_DIR/functions" )
fi
It appears that OMZ is adding $ZUI_REPO_DIR
to fpath
before it actually loads the plugin. This subsequently causes test no. 2,
"${fpath[(r)$ZUI_REPO_DIR]}" != $ZUI_REPO_DIR`
to fail, and $ZUI_REPO_DIR/functions
does not get added to fpath
.
This theory is borne out by the fact that bypassing OMZ's plugin loading, by sourcing ZUI directly in .zshrc
, solves the problem.
Resolution:
It seems that OMZ automatically adds each plugin directory to fpath
before the plugin is actually loaded. This, of
course, clashes with ZUI's method of determining if its function path should be added to fpath
for non-ZI plugin managers.
I notice that ZBrowse does not use the same method to test if its functions directory should be added to fpath
. Perhaps ZUI could be modified to use the same method, or include a check specifically based on the way Oh My Zsh's deals with plugin directories being added to fpath
.
FYI:
The Code of Conduct link is dead
Self-service
- I'd be willing to address this documentation request myself.
Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines.
Are you familiar with the Contributor Covenant Code of Conduct?
- I have read the Contributor Covenant Code of Conduct.
Contact Details
No response