From 95da43507eaed949bc63539052a4c8d40d8bb98a Mon Sep 17 00:00:00 2001 From: Andrey Kislyuk Date: Sat, 2 Dec 2023 18:22:14 -0800 Subject: [PATCH] Use -first- instead of -default- when installing zsh global completer --- argcomplete/bash_completion.d/_python-argcomplete | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/argcomplete/bash_completion.d/_python-argcomplete b/argcomplete/bash_completion.d/_python-argcomplete index cdb60a9..1a8d6fc 100644 --- a/argcomplete/bash_completion.d/_python-argcomplete +++ b/argcomplete/bash_completion.d/_python-argcomplete @@ -115,7 +115,6 @@ __python_argcomplete_which() { } _python_argcomplete_global() { - if [[ -n "${ZSH_VERSION-}" ]]; then # Store result of a regex match in the # BASH_REMATCH variable rather than MATCH @@ -237,8 +236,8 @@ if [[ -z "${ZSH_VERSION-}" ]]; then complete -o default -o bashdefault -D -F _python_argcomplete_global else autoload is-at-least - # Replace only the default completer (_default). - # There are many other special contexts we don't want to override. + # Set a hook for argcomplete to be called first if no other completers are defined for the given command. + # "compdef _python_argcomplete_global -P *" overrides other special contexts that we want to preserve: # https://zsh.sourceforge.io/Doc/Release/Completion-System.html - compdef _python_argcomplete_global -default- + compdef _python_argcomplete_global -first- fi