diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-04 16:11:15 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-04 16:11:15 +0000 |
commit | 66f318d5f45d6318864ac3d368ea2921defcbbec (patch) | |
tree | bf10711e06919f202bf57919dcb0acf40b4747d6 /Completion/Core | |
parent | 2573b87620567ebeddcacf4ec0a7e7b41af755a3 (diff) | |
download | zsh-66f318d5f45d6318864ac3d368ea2921defcbbec.tar.gz zsh-66f318d5f45d6318864ac3d368ea2921defcbbec.tar.xz zsh-66f318d5f45d6318864ac3d368ea2921defcbbec.zip |
zsh-workers/9569
Diffstat (limited to 'Completion/Core')
-rw-r--r-- | Completion/Core/_main_complete | 5 | ||||
-rw-r--r-- | Completion/Core/_prefix | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index ebe256588..a6714cea6 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -20,6 +20,7 @@ setopt localoptions nullglob rcexpandparam extendedglob unsetopt markdirs globsubst shwordsplit nounset ksharrays local comp post ret=1 _compskip _prio_num=1 format _comp_ignore \ + _completers _completers_left \ context state line opt_args val_args curcontext="$curcontext" \ _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \ _saved_exact="${compstate[exact]}" \ @@ -63,11 +64,15 @@ fi # And now just call the completer functions defined. +_completers=( "$@" ) +_completers_left=( "$@" ) + for comp; do if "$comp"; then ret=0 break; fi + shift 1 _completers_left done if (( $compstate[nmatches] )); then diff --git a/Completion/Core/_prefix b/Completion/Core/_prefix new file mode 100644 index 000000000..6306b4aa0 --- /dev/null +++ b/Completion/Core/_prefix @@ -0,0 +1,23 @@ +#autoload + +# Try to ignore the suffix. A bit like e-o-c-prefix. + +[[ -n "$SUFFIX" ]] || return 1 + +local curcontext="${curcontext/:[^:]#:/:prefix:}" comp i + +zstyle -a ":completion:${curcontext}:" completer comp || + comp=( "${(@)_completers[1,-${#_completers_left}-1][(R)_prefix,-1]}" ) + +if zstyle -t ":completion:${curcontext}:" add-space; then + ISUFFIX=" $SUFFIX" +else + ISUFFIX="$SUFFIX" +fi +SUFFIX='' + +for i in "$comp[@]"; do + [[ "$i" != _prefix ]] && "$i" && return 0 +done + +return 1 |