Open JS-Zheng opened 10 months ago
@JS-Zheng,
Can you share more of your zinit configuration? I understand the issue, but confused about the snippet.
Of course!
I'm sorry, I missed this notification. I apologize for the late response. 🥲
Here is my .zshrc
# ==============================================================================
# Zinit [[[
# ==============================================================================
export ZINIT_HOME="$OPT_DIR/zinit"
source "${ZINIT_HOME}/zinit.zsh"
# Theme
zinit lucid depth"1" for \
"_local---p10k" \
romkatv/powerlevel10k
# Workaround for MFS/NFS
zinit lucid is-snippet for \
"$ZSH_CONFIG_DIR/history.zsh"
# Snippets
zinit wait lucid is-snippet for \
"$ZSH_CONFIG_DIR/basis.zsh" \
"$ZSH_CONFIG_DIR/general.zsh" \
"$ZSH_CONFIG_DIR/completion.zsh" \
"$ZSH_CONFIG_DIR/dir.zsh" \
"$ZSH_CONFIG_DIR/vim.zsh" \
"$ZSH_CONFIG_DIR/misc.zsh"
# Plugins
zinit wait lucid depth"1" for \
blockf completions \
if'(( ZRC_HAS_eza == 1 ))' \
"_local---eza" \
if'[[ "$OSTYPE" == "darwin"* ]]' \
"_local---iterm2" \
if'(( ZRC_HAS_lf == 1 ))' \
"_local---lf" \
if'(( ZRC_HAS_pyenv == 1 ))' \
"_local---pyenv" \
if'(( ZRC_HAS_thefuck == 1 ))' \
"_local---fuck" \
if'((ZRC_HAS_zoxide == 1))' \
"_local---zoxide" \
MichaelAquilina/zsh-you-should-use \
jeffreytse/zsh-vi-mode \
atload'_zsh_autosuggest_start' \
zsh-users/zsh-autosuggestions \
if'(( ZRC_HAS_fzf == 1 ))' \
"_local---fzf" \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions \
atinit'zicompinit; zicdreplay' \
zsh-users/zsh-syntax-highlighting
# ]]]
Example of a local plugin: ~/.local/share/zinit/plugins/_local---lf/my-lf.plugin.zsh
lf()
{
local tmp_dir="$(mktemp -d)"
trap 'command rm -rf -- '"$tmp_dir" EXIT
local lf_last_dir="$tmp_dir/lf_last_dir"
# Use `command` to avoid using alias
LF_LAST_DIR="$lf_last_dir" command lf "$@"
# check if the file exists
if [[ ! -f "$lf_last_dir" ]]; then
return
fi
local dir="$(<"$lf_last_dir")"
# check if a valid directory
if [[ ! -d "$dir" ]]; then
return
fi
# change the working directory if necessary
if [[ "$dir" != "$PWD" ]]; then
cd -- "$dir"
fi
}
What happened?
When using the zinit plugins command, it should list both loaded and unloaded plugins. However, I've noticed that all _local prefixed plugins that are loaded are displayed as unloaded. Interestingly, local plugins with free-style names (without the _local prefix) are displayed correctly.
Expected Behavior:
The _local prefixed plugin that was loaded should be displayed as loaded.
Actual Behavior:
The _local prefixed plugin is displayed as unloaded, even though it was loaded.
Steps to reproduce
Relevant output
Screenshots and recordings
No response
Operating System & Version
OS: darwin21.3.0 | Vendor: apple | Machine: x86_64 | CPU: x86_64 | Processor: i386 | Hardware: x86_64
Zsh version
zsh 5.9 (x86_64-apple-darwin21.3.0)
Terminal emulator
xterm-256color
If using WSL on Windows, which version of WSL
None
Additional context
No response
Code of Conduct