about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-07-03 14:00:44 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-07-03 14:00:44 +0000
commit044e8e054cbcc2c25fb95937add58b6fee15c61d (patch)
tree57891d498c02a15020c8eea8651404abdab40192 /Completion
parenta451f3058e3ccd49184e4ce7bb4c57687664ed10 (diff)
downloadzsh-044e8e054cbcc2c25fb95937add58b6fee15c61d.tar.gz
zsh-044e8e054cbcc2c25fb95937add58b6fee15c61d.tar.xz
zsh-044e8e054cbcc2c25fb95937add58b6fee15c61d.zip
12140: make key rebinding for _expand complter easier
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/compinit9
-rw-r--r--Completion/Core/compinstall14
2 files changed, 17 insertions, 6 deletions
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 15eae2607..61128af01 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -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
 
diff --git a/Completion/Core/compinstall b/Completion/Core/compinstall
index 4b519354c..2f784fcc2 100644
--- a/Completion/Core/compinstall
+++ b/Completion/Core/compinstall
@@ -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