12140: make key rebinding for _expand complter easier

This commit is contained in:
Peter Stephenson 2000-07-03 14:00:44 +00:00
parent a451f3058e
commit 044e8e054c
4 changed files with 26 additions and 7 deletions

View file

@ -1,5 +1,10 @@
2000-07-03 Peter Stephenson <pws@cambridgesiliconradio.com>
* 12140: Completion/Core/compinit, Completion/Core/compinstall,
Doc/Zsh/compsys.yo: compinstall calls compinit after styles
are defined; compinit checks for _expand completer and if
necessary rebinds ^i to complete-word.
* Config/version.mk: 3.1.9-dev-2.
* 12138: Src/params.c, Test/06arith.ztst: setting of array

View file

@ -452,6 +452,15 @@ for _i_line in complete-word delete-char-or-list expand-or-complete \
done
zle -la menu-select && zle -C menu-select .menu-select _main_complete
# If the default completer set includes _expand, and tab is bound
# to expand-or-complete, rebind it to complete-word instead.
bindkey '^i' | read -A _i_line
if [[ ${_i_line[2]} = expand-or-complete ]] &&
zstyle -a ':completion:' completer _i_line &&
(( ${_i_line[(i)_expand]} <= ${#_i_line} )); then
bindkey '^i' complete-word
fi
unfunction compinit
autoload -U compinit

View file

@ -1727,17 +1727,19 @@ local tmpout=${TMPPREFIX:-/tmp/zsh}compinstall$$
# insert.
#
{ print -r "$startline
autoload -U compinit
compinit"
[[ -n $fpath_line ]] && print -r "$fpath_line"
print -r "$output"
$output"
if [[ -n $ifile ]]; then
line="zstyle :compinstall filename ${(qq)ifile}"
print -r "$line"
eval "$line"
fi
[[ -n $fpath_line ]] && print -r "$fpath_line"
print -r "
autoload -U compinit
compinit"
print -r "$endline"
} >$tmpout

View file

@ -73,7 +73,10 @@ autoloaded, and will then re-define all widgets that do completion to use the
new system. If you use the tt(menu-select) widget, which is part of the
tt(zsh/complist) module, you should make sure that that module is loaded
before the call to tt(compinit) to make sure that that widget is also
re-defined.
re-defined. If completion styles (see below) are set up to perform
expansion as well as completion by default, and the TAB key is bound to
tt(expand-or-complete), tt(compinit) will rebind it to tt(complete-word);
this is necessary to use the correct form of expansion.
Should you need to use the original completion commands, you can still
bind keys to the old widgets by putting a `tt(.)' in front of the