From f5ba9011f04b56495b665d5a5f334bd2eacf002f Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:37:44 +0000 Subject: 29527: _git: Make file-completion fallback optional. --- Completion/Unix/Command/_git | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 362ec7812..e9eaa86c8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -17,6 +17,16 @@ # # You could even create a function _git-foo() to handle specific completion # for that command. +# +# When _git does not know a given sub-command (say `bar'), it falls back to +# completing file names for all arguments to that sub command. I.e.: +# +# % git bar +# +# ...will complete file names. If you do *not* want that fallback to be used, +# use the `use-fallback' style like this: +# +# % zstyle ':completion:*:*:git*:*' use-fallback false # TODO: There is still undocumented configurability in here. @@ -6025,9 +6035,11 @@ _git() { if (( ${+functions[_git-$words[1]]} )); then _git-$words[1] - else + elif zstyle -T ":completion:${curcontext}:" use-fallback; then _path_files ret=$? + else + _message 'Unknown sub-command' fi ;; esac -- cgit 1.4.1