#compdef kitty

_kitty() {
    (( ${+commands[kitten]} )) || builtin return
    builtin local src cmd=${(F)words:0:$CURRENT}
    # Send all words up to the word the cursor is currently on.
    src=$(builtin command kitten __complete__ zsh "_matcher=$_matcher" <<<$cmd) || builtin return
    builtin eval "$src"
}

if (( $+functions[compdef] )); then
    compdef _kitty kitty
    compdef _kitty clone-in-kitty
    compdef _kitty kitten
fi
