summary refs log tree commit diff
path: root/Completion/compinstall
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-10-05 16:33:34 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-10-05 16:33:34 +0000
commit2dcb35efe04559d7cdede22f507189329020ab10 (patch)
treea66e2c995183668bcee53cd9e74f1ab46f432bd9 /Completion/compinstall
parenta5890553e8c7d51cf8fa8cf0a6ac2bb7a60be2fe (diff)
downloadzsh-2dcb35efe04559d7cdede22f507189329020ab10.tar.gz
zsh-2dcb35efe04559d7cdede22f507189329020ab10.tar.xz
zsh-2dcb35efe04559d7cdede22f507189329020ab10.zip
expand style in compinstall
Diffstat (limited to 'Completion/compinstall')
-rw-r--r--Completion/compinstall51
1 files changed, 51 insertions, 0 deletions
diff --git a/Completion/compinstall b/Completion/compinstall
index 42ef0c330..389196aaf 100644
--- a/Completion/compinstall
+++ b/Completion/compinstall
@@ -1529,11 +1529,13 @@ completions?
 #       squeeze-slashes,
 __ci_do_file_styles() {
   local key files cursor expand speciald ignorep squeezes select
+  local prefon suffon
 
   __ci_get_this_style file-sort files
   __ci_get_this_style ignore-parents ignorep
   __ci_get_this_style special-dirs speciald
   __ci_get_this_style squeeze-slashes squeezes
+  __ci_get_this_style expand expand
 
   while true; do
     clear
@@ -1548,6 +1550,8 @@ __ci_do_file_styles() {
 
 4.  When expanding paths, \`foo//bar' is treated as \`foo/bar'.
 
+5.  Configure how multiple paths are expanded, e.g. /f/b -> /foo/bar
+
 q.  Return without saving.
 0.  Done setting options for filename completion.
 "
@@ -1655,6 +1659,52 @@ one ([y]es, [n]o, [k]eep current setting)?
 	    ([nN]) squeezes=;;
 	  esac
           ;;
+      (5) if [[ $expand = *prefix* ]]; then
+             prefon=prefix
+	  else
+	     prefon=
+	  fi
+	  if [[ $expand = *suffix* ]]; then
+	     suffon=suffix
+	  else
+	     suffon=
+	  fi
+          print "
+When expanding /f/b, the shell will attempt to match /f*/b* (e.g. /foo/bar), 
+and so on to any depth.  If the first part of the expansion fails, by default
+the shell will not expand the remainder.  However, you can force it always
+to expand the first part.  Currently this feature is ${${prefon:+on}:-off}.
+Do you want it on ([y]es, [n]o, [k]eep current setting)?
+"
+	  while true; do
+	    read -k key'?--- Hit selection --- '
+	    [[ $key = [yYnNkK] ]] && break
+	    print "Type one of y, n or k."
+	  done
+	  case $key in
+	    ([yY]) prefon=prefix;;
+	    ([nN]) prefon=prefix;;
+	  esac
+	  print "
+Further, if /f*/b* is ambiguous, the shell will usually only expand
+as far as the part that is unambiguous; for example, if /foo/bar and
+/food/basket exist, it will wait for you to choose either /foo or /food,
+and not attempt to expand the rest of the match.  However, you can force
+it to add all possible completions for you to resolve conflicts in the
+normal way.  Currently this feature is ${${suffon:+on}:-off}.
+Do you want it on ([y]es, [n]o, [k]eep current settign)?
+"
+	  while true; do
+	    read -k key'?--- Hit selection --- '
+	    [[ $key = [yYnNkK] ]] && break
+	    print "Type one of y, n or k."
+	  done
+	  case $key in
+	    ([yY]) suffon=suffix;;
+	    ([nN]) suffon=suffix;;
+	  esac
+	  expand=${prefon:+$prefon${suffon:+ }}${suffon}
+	  ;;
       (q) return 1
 	 ;;
     esac
@@ -1665,6 +1715,7 @@ one ([y]es, [n]o, [k]eep current setting)?
   __ci_set_this_style ignore-parents ignorep
   __ci_set_this_style special-dirs speciald
   __ci_set_this_style squeeze-slashes squeezes
+  __ci_set_this_style expand expand
 
   return 0
 }