zi icon indicating copy to clipboard operation
zi copied to clipboard

bug: installing `OMZP::kubectl` doesn't provide completions

Open hellt opened this issue 10 months ago • 2 comments

Environment

Debian 12

Reproduction steps

1. install omzp::kubectl by putting `zi snippet OMZP::kubectl` in `.zshrc`
2. type `k` and press tab

Expected behavior

1. completions are displayed

Current behavior

completions are not shown, the output is:

❯ k 
(eval):1: _kubectl: function definition file not found

Code snippet

# init direnv
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#how-do-i-initialize-direnv-when-using-instant-prompt
(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv export zsh)"

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv hook zsh)"


if [[ -r "/home/rd/.config/zi/init.zsh" ]]; then
  source "/home/rd/.config/zi/init.zsh" && zzinit
fi

# history settings
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

# powerlevel prompt installation powered by zi (wiki.zshell.dev)
zi ice depth=1; zi light romkatv/powerlevel10k

# pyenv initialization
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

# LS colors
alias ls='ls --color=auto'
zi ice atclone'dircolors -b LS_COLORS > clrs.zsh' \
  atpull'%atclone' pick"clrs.zsh" nocompile'!' \
  atload'zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}'
zi light trapd00r/LS_COLORS

# docker completion
zi ice wait lucid; zi light greymd/docker-zsh-completion

# syntax highlighting
zi ice wait lucid; zi light z-shell/F-Sy-H

# patch dl ice modifiers that are required by some zi packages
# https://wiki.zshell.dev/ecosystem/annexes/patch-dl
zi light z-shell/z-a-patch-dl

# fzf
zi pack"binary+keys" for fzf

# gh completions
if command -v gh > /dev/null; then
  zi ice lucid wait as'completion' blockf has'gh'
  zi snippet "$HOME/.local/share/completions/_gh"
fi

# containerlab completions
if command -v containerlab > /dev/null; then
  zi ice lucid wait as'completion' blockf has'containerlab'
  zi snippet "$HOME/.local/share/completions/_containerlab"
fi

# kubectl plugin from ohmyzsh
zi snippet OMZP::kubectl

# disable highlighting pasted text
# https://forums.freebsd.org/threads/bracketed-paste.81314/#:~:text=You%20can%20also%20simply%20disable,zshrc.
zle_highlight=('paste:none')

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh


autoload -Uz compinit
compinit

zi cdreplay -q # <- execute compdefs provided by rest of plugins

Additional information

❯ zi zstatus          
Directories set: 
Home: /home/rd/.zi
Binary: /home/rd/.zi/bin
Plugin: /home/rd/.zi/plugins
Snippet: /home/rd/.zi/snippets
Service: /home/rd/.zi/services
Modules: /home/rd/.zi/zmodules
User-land: /home/rd/.zi/polaris
Completions:/home/rd/.zi/completions
Loaded plugins: 6
Light loaded: 2
Downloaded plugins: 6
Compiled plugins: 5
Enabled completions: 7
Disabled completions: 0
Completions available overall: 7
Snippets loaded: 
/home/rd/.local/share/completions/_containerlab <single file>, /home/rd/.local/share/completions/_gh <single file>, OMZP::kubectl <single file> 

Self-service

  • [X] I'd be willing to address this documentation request myself.

Have you read the Contributing Guidelines?

Are you familiar with the Contributor Covenant Code of Conduct?

Contact Details

No response

hellt avatar Apr 24 '24 20:04 hellt

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a 👍 Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar May 25 '24 08:05 github-actions[bot]

Do completions work for kubectl? The completions for the k alias are working for me. Have you tried adding atload"zicompinit; zicdreplay"?

nickcaballero avatar Jul 26 '24 20:07 nickcaballero