diff --git a/.zsh/autocompletion.zsh b/.zsh/autocompletion.zsh deleted file mode 100644 index 1562b03..0000000 --- a/.zsh/autocompletion.zsh +++ /dev/null @@ -1,5 +0,0 @@ -autoload -Uz compinit && compinit - -if type "kubectl" > /dev/null; then - source <(kubectl completion zsh) -fi \ No newline at end of file diff --git a/.zsh/lazy.sh b/.zsh/lazy.sh new file mode 100644 index 0000000..5166a1f --- /dev/null +++ b/.zsh/lazy.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env zsh + +# Check if 'kubectl' is a command in $PATH +if [ $commands[kubectl] ]; then + + # Placeholder 'kubectl' shell function: + # Will only be executed on the first call to 'kubectl' + kubectl() { + + # Remove this function, subsequent calls will execute 'kubectl' directly + unfunction "$0" + + # Load auto-completion + source <(kubectl completion zsh) + + # Execute 'kubectl' binary + $0 "$@" + } +fi diff --git a/.zshrc b/.zshrc index 3eaf37c..7670cbe 100644 --- a/.zshrc +++ b/.zshrc @@ -1,3 +1,5 @@ +DISABLE_AUTO_UPDATE=true + iscmd() { command -v "$1" > /dev/null }