From 29a8ff61b3cf48c99bd3db732424c71c5577dc5a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 3 May 2022 23:53:04 +0200 Subject: [PATCH] fix: Don't complete _command on zsh Previously the generated zsh completion script started with the line #compdef _ where is the command that the zsh completion script is generated for. This enabled completions for both and _, but _ is the completion function itself and should not be completed. Furthermore, attempting to autocomplete _ (e.g. typing "_" in a zsh shell) causes zsh to hang. This commit fixes the #compdef line to only complete , not _. Co-authored-by: Arvid Norlander --- zsh_completions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh_completions.go b/zsh_completions.go index c6048a9e5..072921f91 100644 --- a/zsh_completions.go +++ b/zsh_completions.go @@ -75,7 +75,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) { if !includeDesc { compCmd = ShellCompNoDescRequestCmd } - WriteStringAndCheck(buf, fmt.Sprintf(`#compdef _%[1]s %[1]s + WriteStringAndCheck(buf, fmt.Sprintf(`#compdef %[1]s # zsh completion for %-36[1]s -*- shell-script -*-