Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: compinstall tweak



(Did anybody get this month's FAQ posting?  Mine disappeared again.)

This is on top of Andrej's patch in 13544.  Andrej, you can commit this
with the other bit when you're happy.

I shortened the description and added a separate tweak that compinstall
remembers any arguments you had after `compinit'.

--- Completion/Core/compinstall.before	Mon Mar  5 21:18:21 2001
+++ Completion/Core/compinstall	Mon Mar  5 21:30:09 2001
@@ -25,7 +25,7 @@
 
 typeset startline='# The following lines were added by compinstall'
 typeset endline='# End of lines added by compinstall'
-typeset ifile line fpath_line
+typeset ifile line fpath_line compinit_args
 typeset -A styles
 typeset match mbegin mend warn_unknown warn_old warn_comment
 integer lines_found
@@ -115,6 +115,9 @@
       # no-op
     elif [[ $line = [[:blank:]]#\#* ]]; then
       warn_comment=1
+    elif [[ $line = [[:blank:]]#compinit[[:blank:]]##(#b)([^[:blank:]]*) ]]
+    then
+      compinit_args=$match[1]
     elif [[ $line != [[:blank:]]# &&
       $line != [[:blank:]]#'autoload -U compinit' &&
       $line != [[:blank:]]#compinit &&
@@ -916,18 +919,16 @@
     print "\
               *** compinstall: matcher menu ***
 
-\`Matchers' allow the completion code to play extra tricks when comparing
-the string on the command line with a possible match, as listed below.
-A list of different matchers can be given. The numbers given below show what is
-included in each element of the list; by default everything for 1 is tried
-at the same time, then if necessary everything for 2, etc. until at least
-one possible completion is found. You can change it so that every element
-in the list is added to preceding one(s) instead; this indicated by '+' over
-the element. If no matcher is set ordinary completion will be done at that
-point. Elements from 1 to 4 can be set; empty trailing elements will be
-removed, and if nothing is set, the style will not be set.
+\`Matchers' compare the completion code with the possible matches in some
+special way.  Numbers in parentheses show matchers to be tried and the order.
+The same number can be assigned to different matchers, meaning apply at the
+same time.  Omit a sequence number to try normal matching at that point.
+A \`+' in the first line indicates the element is added to preceeding matchers
+instead of replacing them; toggle this with \`t'.  You don't need to set
+all four, or indeed any matchers --- then the style will not be set.
 
-   ($a_or_r)
+   ($a_or_r)\
+   \`+' indicates add to previous matchers, else replace
 n. ($n_list)\
  No matchers; you may want to try this as the first choice.
 c. ($c_list)\
@@ -941,7 +942,7 @@
  Substring completion:  complete on substrings, not just initial
           strings.  Warning: it is recommended this not be used for element 1.
 
-t.        Toggle replace/augment for matcher group
+t.        Toggle replacing previous matchers (\` ' at top) or add (\`+')
 q.        Return without saving.
 0.        Done setting matchers.
 "
@@ -1780,7 +1781,7 @@
 
   print -r "
 autoload -U compinit
-compinit"
+compinit${compinit_args:+ $compinit_args}"
 
   print -r "$endline"
 } >$tmpout

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



Messages sorted by: Reverse Date, Date, Thread, Author