summaryrefslogtreecommitdiff
path: root/Doc/Zsh/contrib.yo
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/Zsh/contrib.yo')
-rw-r--r--Doc/Zsh/contrib.yo52
1 files changed, 35 insertions, 17 deletions
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index d32ba018d..c6bf745b7 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -677,7 +677,7 @@ As an example, ~[g:p:s] might specify:
startitem()
item(tt(g))(
The top level directory for your git area. This first component
-has to match, or the function will retrun indicating another
+has to match, or the function will return indicating another
directory name hook function should be tried.
)
item(tt(p))(
@@ -1343,11 +1343,11 @@ endsitem()
In tt(patch-format) and tt(nopatch-format) these replacements are done:
startsitem()
-sitem(tt(%p))(The name of the top-most applied patch (tt(applied-string)).)
-sitem(tt(%u))(The number of unapplied patches (tt(unapplied-string)).)
+sitem(tt(%p))(The name of the top-most applied patch; may be overridden by the tt(applied-string) hook.)
+sitem(tt(%u))(The number of unapplied patches; may be overridden by the tt(unapplied-string) hook.)
sitem(tt(%n))(The number of applied patches.)
sitem(tt(%c))(The number of unapplied patches.)
-sitem(tt(%a))(The number of all patches.)
+sitem(tt(%a))(The number of all patches (tt(%a = %n + %c)).)
sitem(tt(%g))(The names of active tt(mq) guards (tt(hg) backend).)
sitem(tt(%G))(The number of active tt(mq) guards (tt(hg) backend).)
endsitem()
@@ -2227,7 +2227,20 @@ is set in the context tt(:zle:*) to tt(true) if the word style is
tt(bash) and tt(false) otherwise. It may be overridden by setting it in
the more specific context tt(:zle:forward-word*).
-Here are some examples of use of the styles, actually taken from the
+It is possible to create widgets with specific behaviour by defining
+a new widget implemented by the appropriate generic function, then
+setting a style for the context of the specific widget. For example,
+the following defines a widget tt(backward-kill-space-word) using
+tt(backward-kill-word-match), the generic widget implementing
+tt(backward-kill-word) behaviour, and ensures that the new widget
+always implements space-delimited behaviour.
+
+example(zle -N backward-kill-space-word backward-kill-word-match
+zstyle :zle:backward-kill-space-word word-style space)
+
+The widget tt(backward-kill-space-word) can now be bound to a key.
+
+Here are some further examples of use of the styles, actually taken from the
simplified interface in tt(select-word-style):
example(zstyle ':zle:*' word-style standard
@@ -4284,9 +4297,10 @@ See also the tt(pager), tt(prompt) and tt(rprompt) styles below.
findex(regexp-replace)
item(tt(regexp-replace) var(var) var(regexp) var(replace))(
Use regular expressions to perform a global search and replace operation
-on a variable. If the option tt(RE_MATCH_PCRE) is not set, POSIX
-extended regular expressions are used, else Perl-compatible regular
-expressions (this requires the shell to be linked against the tt(pcre)
+on a variable. POSIX extended regular expressions are used,
+unless the option tt(RE_MATCH_PCRE) has been set, in which case
+Perl-compatible regular expressions are used
+(this requires the shell to be linked against the tt(pcre)
library).
var(var) is the name of the variable containing the string to be matched.
@@ -4417,24 +4431,28 @@ the elements from the tt(input) list in each run. If no var(command) is
provided, then no var(arg) list may be provided, and in that event the
default command is `tt(print)' with arguments `tt(-r -)tt(-)'.
-For example, to get a long tt(ls) listing of all plain files in the
-current directory or its subdirectories:
+For example, to get a long tt(ls) listing of all non-hidden plain files
+in the current directory or its subdirectories:
example(autoload -U zargs
-zargs -- **/*(.) -- ls -l)
+zargs -- **/*(.) -- ls -ld --)
+
+The first and third occurrences of `tt(-)tt(-)' are used to mark the end
+of options for tt(zargs) and tt(ls) respectively to guard against
+filenames starting with `tt(-)', while the second is used to separate the
+list of files from the command to run (`tt(ls -ld --)').
+
+The first `tt(-)tt(-)' would also be needed if there was a chance the
+list might be empty as in:
-Note that `tt(-)tt(-)' is used both to mark the end of the var(option)
-list and to mark the end of the var(input) list, so it must appear twice
-whenever the var(input) list may be empty. If there is guaranteed to be
-at least one var(input) and the first var(input) does not begin with a
-`tt(-)', then the first `tt(-)tt(-)' may be omitted.
+example(zargs -r -- ./*.back+LPAR()#qN+RPAR() -- rm -f)
In the event that the string `tt(-)tt(-)' is or may be an var(input), the
tt(-e) option may be used to change the end-of-inputs marker. Note that
this does em(not) change the end-of-options marker. For example, to use
`tt(..)' as the marker:
-example(zargs -e.. -- **/*(.) .. ls -l)
+example(zargs -e.. -- **/*(.) .. ls -ld --)
This is a good choice in that example because no plain file can be named
`tt(..)', but the best end-marker depends on the circumstances.