kubectx: Completions not working with oh-my-zsh on Linux
I am working on Linux with oh-my-zsh and I can’t get completions to work.
I have updated my fpath line in ~/.oh-my-zsh/oh-my-zsh.sh to be:
fpath=($ZSH/functions $ZSH/completions /home/username/kubectx/completion $fpath)
When I run echo $fpath, I get the expected output:
... /home/username/kubectx/completion ...
The directory above (/home/username/kubectx/completion) contains only one script, which is the kubectx.zsh script in the repo.
Have I done something wrong in the setup?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
Had the same issue - in my case, probably after a MacOS upgrade or something, the used zsh switched from homebrew-installed zsh (
/usr/local/bin/zsh) to the MacOS’s own zsh,/bin/zsh. You can compare their versions via/usr/local/bin/zsh --versionand/bin/zsh --version. To see the current version you are using, checkecho $ZSH_VERSION, and also checkcat /etc/shellsto see a list of available shells.If you are on MacOS zsh, you need to switch to the one comes from Homebrew, since that one has
/usr/local/share/zsh/site-functionsin FPATH - the location whichbrew install kubectxinstalls the completions.To switch to Homebrew zsh, simply check your
/etc/shells, if/usr/local/bin/zshis missing, add it:then
Open a new shell and verify via
echo $ZSH_VERSIONEdit: Noticed that the original issue was on Linux, anyway, this can be help for people having similar issue on MacOS.
Works now! Thanks @edmeister.
My final
fpathis:fpath=($ZSH/functions $ZSH/completions $fpath).I put the
kubectx.zshfile in$ZSH/completionsfolder and renamed it to_kubectx.The file names should start with an underscore to be loaded by zsh.