简体   繁体   中英

Not sure where to put completions with Oh My Zsh

I'm using zsh and oh my zsh, and I'm a bit confused about where to put completion files.

For example, when installing kind , I'm doing this:

brew install kind
kind complete zsh > ~/.oh-my-zsh/cache/completions/_kind

And I expect that completions for kind would start working. Am I putting them in the wrong dir?

If I do autoload -U compinit && compinit in the current terminal, completions work until I restart the terminal.

My .zshrc is pretty standard I think, this is basically what I've got:

# 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

export ZSH="$HOME/.oh-my-zsh"

DISABLE_MAGIC_FUNCTIONS="true"

plugins=(
  git
  gh
  docker
  docker-compose
  kubectl
  helm
  dotnet
  node
  npm
  github
  zsh-syntax-highlighting
  zsh-autosuggestions
  history-substring-search
  terraform)
autoload -U compinit && compinit

source $ZSH/oh-my-zsh.sh

Does the autoload -U compinit && compinit has to happen after I source oh my zsh? If so, why? 🤔

Have you tried putting the completions not in the cache directory.

kind complete zsh > ~/.oh-my-zsh/completions/_kind

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM