4

I installed kubectl and tried enable shell autocompletion for zsh. When I'm using kubectl autocompletion works fine. Howewer when I'm trying use autocompletion with alias k then shell return me

k g...(eval):1: command not found: __start_kubectl                                                                                                                            8:45 
(eval):1: command not found: __start_kubectl
(eval):1: command not found: __start_kubectl

In my .zshrc file I have:

source <(kubectl completion zsh)
alias k=kubectl
compdef __start_kubectl k
Dawid Krok
  • 61
  • 1
  • 3

2 Answers2

1

Can you try this one:

compdef _kubectl k
Vasili Angapov
  • 8,061
  • 15
  • 31
  • After execute `compdef _kubectl k` and input `k g` and pres tab, shell return me ```o matches: `completions' or `filename'``` – Dawid Krok Jan 11 '22 at 10:21
1

add the following to the beginning of your ~/.zshrc file:

autoload -Uz compinit
compinit

then restart your terminal.

M.A.K. Simanto
  • 634
  • 1
  • 7
  • 20