Skip to content

Commit 37d481d

Browse files
twpayneVorpalBlade
andauthored
fix: Don't complete _command on zsh (#1690)
Previously the generated zsh completion script started with the line #compdef _<command> <command> where <command> is the command that the zsh completion script is generated for. This enabled completions for both <command> and _<command>, but _<command> is the completion function itself and should not be completed. Furthermore, attempting to autocomplete _<command> (e.g. typing "_<command><Space><Tab>" in a zsh shell) causes zsh to hang. This commit fixes the #compdef line to only complete <command>, not _<command>. Co-authored-by: Arvid Norlander <[email protected]>
1 parent 5b11656 commit 37d481d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zsh_completions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) {
7575
if !includeDesc {
7676
compCmd = ShellCompNoDescRequestCmd
7777
}
78-
WriteStringAndCheck(buf, fmt.Sprintf(`#compdef _%[1]s %[1]s
78+
WriteStringAndCheck(buf, fmt.Sprintf(`#compdef %[1]s
7979
8080
# zsh completion for %-36[1]s -*- shell-script -*-
8181

0 commit comments

Comments
 (0)