Add #compdef comment to zsh completion

This will allow adding completions without using `kitty + complete setup zsh | source /dev/stdin` by piping the code into a file named `_kitty` in a directory in `$fpath` instead of piping to `source`. This is especially handy for package managers that package kitty.
See https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org.
The `compdef _kitty kitty` line at the end doesn't seem to have any ill effects when using the completion code in a completion function file. When piping the code to `source` like before, the added line should be interpreted as a comment and be ignored.
This commit is contained in:
Luflosi
2020-03-10 20:16:27 +01:00
parent 10435c23c2
commit 6d1fd20542

View File

@@ -61,7 +61,8 @@ def remote_control_command_names() -> Tuple[str, ...]:
completion_scripts = {
'zsh': '''
'zsh': '''#compdef kitty
_kitty() {
local src
# Send all words up to the word the cursor is currently on