(after compinit)

July 17, 2026 · View on GitHub

██╗  ██╗██╗   ██╗██████╗ ███████╗ ██████╗████████╗██╗     
██║ ██╔╝██║   ██║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██║     
█████╔╝ ██║   ██║██████╔╝█████╗  ██║        ██║   ██║     
██╔═██╗ ██║   ██║██╔══██╗██╔══╝  ██║        ██║   ██║     
██║  ██╗╚██████╔╝██████╔╝███████╗╚██████╗   ██║   ███████╗
╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝   ╚═╝   ╚══════╝
                                                          

License: MIT zshrs plugin

[LIVE KUBECTL COMPLETION — COMPILED]

"delegates to kubectl __complete — always in sync with your kubectl."

[NATIVE ZSHRS PLUGIN]

kubectl completion as a native zshrs plugin. Instead of a large static, version-pinned _kubectl completion function, this delegates to cobra's built-in completion protocolkubectl __complete <args…> <partial> — which every modern kubectl exposes. It returns candidates for the kubectl version you actually have installed, so there is nothing to keep in sync with kubectl releases.

zshrs · znative


Table of Contents


[0x00] OVERVIEW

kubectl <TAB>             → annotate api-resources apply attach auth …
kubectl g<TAB>            → get
kubectl config <TAB>      → current-context get-contexts use-context …
kubectl get -<TAB>        → --namespace --output --selector …
kubectl get pod <TAB>     → (live pod names, when a cluster is reachable)

Requires kubectl on PATH. Subcommand/flag completion works offline; resource completion queries the cluster (exactly as a _kubectl completion's kubectl get calls do).


[0x01] INSTALL

znative load MenkeTechnologies/zshrs-kubectl-completion

Put that one line in your .zshrc. znative, zshrs's package manager, installs the plugin on the first shell start — clones it, runs cargo build --release, and zmodload -Rs the resulting libkubectl_completion — then loads it from the store, zero-network, on every start after. No separate install step; then kubectl <TAB> completes.

Manual build

cargo build --release
zmodload -R ./target/release/libkubectl_completion.dylib   # .so on Linux
# (after compinit)
kubectl get po<TAB>

[0x02] USAGE

After loading, kubectl <TAB> completes subcommands, flags, and — when a cluster is reachable — live resource names, for whatever kubectl version is on PATH.


[0x03] HOW IT WORKS

A completions: generator in the znative SDK receives the current command line, runs kubectl __complete with those words, and emits the candidate column of cobra's name\tdescription output (stopping at the trailing :<directive> line). See the zshrs plugin porting guide: docs/PORTING_ZSH_PLUGIN.md.


[0xFF] LICENSE

MIT. An independent implementation (delegates to kubectl __complete); inspired by nnao45/zsh-kubectl-completion but shares no code with it. See LICENSE.