about summary refs log tree commit diff
path: root/Completion/Base/_match_pattern
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:17:36 +0000
commit904b939cbd81a542303da2c58288b95b153106f5 (patch)
tree84b3751ed1deacc51eb186023101360ae92ef221 /Completion/Base/_match_pattern
parentb4a5b9db8b528f9c9b6a9cbb00db381c95659380 (diff)
downloadzsh-3.1.5-pws-10.tar.gz
zsh-3.1.5-pws-10.tar.xz
zsh-3.1.5-pws-10.zip
zsh-3.1.5-pws-10 zsh-3.1.5-pws-10
Diffstat (limited to 'Completion/Base/_match_pattern')
-rw-r--r--Completion/Base/_match_pattern31
1 files changed, 31 insertions, 0 deletions
diff --git a/Completion/Base/_match_pattern b/Completion/Base/_match_pattern
new file mode 100644
index 000000000..c5debc0b9
--- /dev/null
+++ b/Completion/Base/_match_pattern
@@ -0,0 +1,31 @@
+#autoload
+
+# This function is called from functions that do matching whenever they
+# need to build a pattern that is used to match possible completions.
+# It gets the name of the calling function and two names of parameters
+# as arguments. The first one is used in the calling function to build
+# the pattern used for matching possible completions. The content of this
+# parameter on entry to this function is the string taken from the line.
+# Here it parameter should be changed to a pattern that matches words as
+# the match specs currently in use do.
+# In the calling function this pattern may be changed again or used only 
+# in parts. The second parameter whose name is given as the third argument
+# allows to give pattern flags liek `(#l)' that are to be used whenever
+# matching is done.
+#
+# As an example, if you have global match specifications like:
+#
+#  compctl -M 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z} r:|[.-]=* r:|=*'
+#
+# This function would look like:
+#
+#   eval "${3}='(#l)'"
+#   [[ MATCHER -eq 2 ]] && eval "$1='${(P)2:gs/./*./:gs/-/*-/}'"
+#
+# The first line makes sure that matching is done case-insensitive as
+# specified by `m:{a-z}={A-Z}'. The second line replaces dots and hyphens
+# in the given string by patterns matching any characters before them,
+# like the `r:|[.-]=* r:|=*'. To make this work, the function `_match_test'
+# would have to be changed to `(( MATCHERS <= 2 ))'
+#
+# The default implementation of this function is empty.