diff options
90 files changed, 2217 insertions, 884 deletions
@@ -1,3 +1,323 @@ +2015-05-27 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: Config/version.mk: 5.0.7-dev-4. + +2015-05-27 Daniel Hahler <zsh@thequod.de> + + * 35285: Functions/Chpwd/_cdr: fix zstyle lookup for + recent-dirs-insert. + + * 35286: Completion/Unix/Command/_baz, Completion/Unix/Command/_tla: + fix zstyle lookups with _baz and _tla. + + * 35293: Completion/Unix/Command/_php: fix zstyle lookup with + _php: use trailing colon. + +2015-05-27 Peter Stephenson <p.stephenson@samsung.com> + + * Han Pingtian: 35299: Functions/Zftp/zfdir: improve effect of + zfdir -r. + +2015-05-26 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35289: Doc/Zsh/builtions.yo: fix typos in the description + of emulate builtin (based on 34981 by Han Pingtian) + +2015-05-26 Peter Stephenson <p.stephenson@samsung.com> + + * see 35268: revert 34476 (ae7dcab) as it seems to be having + effects beyond the intended optimisation of completion caching. + To be investigated further after the release. + + * Han Pingtian: 35295: Functions/Zftp/zfcd_match: be more + inventive zftp directory listing. + + * Eric Cook: 35292: Completion/Redhat/Command/_yum: complete + installation of local files. + +2015-05-23 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 35127#1: Src/Zle/compcore.c Src/Zle/computil.c: Fix + _describe/compdescribe problem with unsorted groups + +2015-05-22 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 35266: Src/exec.c: test from users/20203 needed changing + because of jumps in locallevel. + +2015-05-23 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35255: configure.sc, Doc/Makefile.in: if available, use + texi2any instead of texi2html + +2015-05-22 Daniel Hahler <zsh@thequod.de> + + * 35261: Completion/Unix/Command/_git: make $ret local in + __git_recent_commits. + +2015-05-21 Peter Stephenson <p.stephenson@samsung.com> + + * 35250: Doc/Zsh/grammar.yo: fix case documentation (SH_GLOB). + + * 35248: Src/lex.c, Src/parse.c, Test/A01grammar.ztst: + treat fully parenthesised zsh patterns as complete + case patterns again. + +2015-05-20 Peter Stephenson <p.stephenson@samsung.com> + + * Ismail: 35232: Completion/Unix/Type/_urls: matching + parentheses. + +2015-05-20 Barton E. Schaefer <schaefer@zsh.org> + + * 35231: Src/params.c: make mkevnstr() safe for NULL value + +2015-05-19 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 35224: Completion/Unix/Command/_git: completion: git: Add + fast-export --signed-tags=warn-strip + +2015-05-19 Daniel Hahler <zsh@thequod.de> + + * 35164: Completion/Unix/Command/_git: fix $pipestatus with + __git_commit_objects/__git_recent_commits. + + * 35204: Completion/Unix/Command/_git: fix quoting in previous commit + commit (35164). + + * 35209: Completion/Unix/Command/_git: remove -2 _describe in + __git_recent_commits. This fixes duplicate entries, because + __git_recent_commits gets called twice for _git-checkout + (for __git_revisions and __git_tree_ishs). + + * 35211: Completion/Unix/Command/_git: __git_commit_objects: + do not use _guard, but only a pattern for skipping. + + * 35217: Completion/Unix/Command/_git: _git-send-email: + provide completions from `__git_commit_objects_prefer_recent`. + +2015-05-19 Daniel Shahaf <d.s@daniel.shahaf.name> + + * users/20222: Completion/Unix/Command/_git: users/20222: + completion: git: Add matchspec for heads + +2015-05-18 Peter Stephenson <p.stephenson@samsung.com> + + * 35193: Doc/Zsh/builtins.yo, Src/builtin.c, Src/hashtable.h, + Test/A02alias.ztst: add "unalias -a". + + * 35187: Completion/Unix/Command/_vim: fix unbalanced parentheses. + + * 35184: Src/parse.c, Test/A01grammar.ztst: fix pattern parsing + after "|" in 35168. + + * 35168: Completion/Unix/Command/_ant, + Completion/Unix/Command/_cp, Completion/Unix/Command/_locate, + Completion/Unix/Command/_make, Completion/Unix/Command/_tar, + Completion/Unix/Type/_path_commands, + Completion/X/Command/_xrandr, Config/version.mk, Src/lex.c, + Src/loop.c, Src/parse.c, Src/text.c, Test/A01grammar.ztst: + Fix parsing of case patterns so "|" is extracted by looking + for words; quote completion functions where needed in + consequence; add test; updated version number to 5.0.7-dev-3 + because of wordcode incompatibility. + +2015-05-18 Daniel Hahler <git@thequod.de> + + * 35126: Completion/Unix/Command/_git: __git_recent_commits: + add "return $ret" to make it useful when being called in a pipeline. + + * 35100: Completion/Unix/Command/_git: __git_recent_commits: + massage ' ->*' from heads. + Handle " -> master, origin/master" in decorated git-log output, and + add it as separate entries. + + * 35101: Completion/Unix/Command/_git: add + __git_commit_objects_prefer_recent. This is used with __git_commits + then, and is meant to only call __git_recent_commits, if there are + matches. + + * 35104: Completion/Unix/Command/_git: __git_commit_objects: query + 1000 commits. Also, `--all` and `--reflog` is used to get all commits. + + * 35103: Completion/Unix/Command/_git: add %cr to commit objects (all + and recent). + + * 35106: completion: git: unique name for __git_recent_commits. + + * Daniel Shahaf: 35105: Completion/Unix/Command/_git: add + distance_from_head to __git_recent_commits. + +2015-05-16 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 35161: Completion/Unix/Command/_git: completion: git: Fix + typo in 35061 + +2015-05-15 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 35155: Src/lex.c: cmdpop() could sometimes get called too + often on error. + +2015-05-15 Oliver Kiddle <opk@zsh.org> + + * users/20219: Completion/Unix/Command/_git: fix for git options + +2015-05-15 Peter Stephenson <p.stephenson@samsung.com> + + * 35154: NEWS: news on arithmetic evaluation changes. + + * 35153: Src/subst.c, Test/C01arith.ztst: nested math substitution. + + * 35151: Src/subst.c: improved check for both b and q flags. + + * 35131: Src/pattern.c: "[]" in a pattern is treated as an empty + character set (matching nothing) if there are no more active "]" + is in the pattern. + +2015-05-14 Oliver Kiddle <opk@zsh.org> + + * 35139: Completion/Zsh/Context/_brace_parameter: add (b) flag + + * Øystein Walle: 34841 (tweaked): Src/builtin.c: + allow grouping of thousands in printf format string + + * unposted: Completion/BSD/Type/.distfiles: include new dir + + * Daniel Hahler: 35062: Completion/Unix/Command/_git: + __git_setup_revision_options includes __git_setup_diff_options + + * Daniel Hahler: 35061: Completion/Unix/Command/_git: + add __git_setup_diff_stage_options and use it with + _git-diff-files and _git-diff explicitly + + * Daniel Hahler: 35016: Completion/Unix/Command/_git: + introduce new pretty formats %g[sdD] for reflog information + +2015-05-14 Peter Stephenson <p.stephenson@samsung.com> + + * 35110: Src/builtin.c, Doc/Zsh/params.yo: don't + implicitly initialize restricted integers to zero. + +2015-05-13 Oliver Kiddle <opk@zsh.org> + + * 35092: Src/Zle/zle_params.c: fix for numeric arguments + from vi operator pending mode + + * 35093: NEWS, Functions/Zle/select-bracketed, + Functions/Zle/select-quoted, Functions/Zle/surround: + new zle widgets for Vim-style text objects + +2015-05-13 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 35114: Src/Modules/zutil.c: zformat -a multibyte char widths. + + * Christian Hesse: 35107: Completion/Unix/Command/_ip: new ip + options. + +2015-05-13 Peter Stephenson <p.stephenson@samsung.com> + + * users/20203: Src/builtin., Src/exec.c, Test/A01grammar.ztst: + nested function in always traps after exit didn't work. + +2015-05-12 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35086: Doc/Zsh/expn.yo: reapply 35067 (with 35071) which + has been mistakenly reverted by 35075 + +2015-05-12 Daniel Hahler <git@thequod.de> + + * 35060 + 35072: Completion/Unix/Command/_git: completion: git: split + __git_heads into local and remote + +2015-05-12 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35075: Doc/Zsh/builtins.yo, Doc/Zsh/calsys.yo, + Doc/Zsh/compctl.yo, Doc/Zsh/compsys.yo, Doc/Zsh/compwid.yo, + Doc/Zsh/contrib.yo, Doc/Zsh/expn.yo, Doc/Zsh/mod_clone.yo, + Doc/Zsh/mod_complist.yo, Doc/Zsh/mod_curses.yo, + Doc/Zsh/mod_parameter.yo, Doc/Zsh/mod_pcre.yo, + Doc/Zsh/mod_sched.yo, Doc/Zsh/mod_stat.yo, Doc/Zsh/mod_system.yo, + Doc/Zsh/mod_zftp.yo, Doc/Zsh/mod_zpty.yo, Doc/Zsh/mod_zselect.yo, + Doc/Zsh/mod_zutil.yo, Doc/Zsh/options.yo, Doc/Zsh/params.yo, + Doc/Zsh/tcpsys.yo, Doc/Zsh/zftpsys.yo, Doc/Zsh/zle.yo: improve + manual format + + * unposted: ChangeLog: fixed entry for 35034 (2015-05-06) + +2015-05-11 Oliver Kiddle <opk@zsh.org> + + * 35049 (tweaked to make jname default): Completion/BSD/Type/_jails, + Completion/Unix/Command/_ps, Completion/Unix/Command/_pgrep: + allow jail completion to include jid 0 for the host and to complete + jails by any parameter + +2015-05-11 Peter Stephenson <p.stephenson@samsung.com> + + * 35078: Src/zsh.h, Test/D04parameter.ztst: also quote backslash + with (b) flag. + +2015-05-10 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 35067 (doc tweak from Daniel, 35071): Doc/Zsh/expn.yo, + Src/subst.c, Src/utils.c, Src/zsh.h, Src/ztype.h, + Test/D04parameter.ztst: add ${(b)foo} for backslash + quoting of patterns. + +2015-05-10 Mikael Magnusson <mikachu@gmail.com> + + * 35065: Src/zsh.h: Don't treat NUL as a combining character + +2015-05-09 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 35066: Completion/Unix/Command/_python + Completion/Unix/Command/_subversion: Minor completion fix for + pasted arguments + +2015-05-09 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35064: Src/pattern.c, Src/utils.c, Src/ztype.h: rename + ISPRINT to ZISPRINT to avoid name conflict + +2015-05-08 Peter Stephenson <p.stephenson@samsung.com> + + * 35059: Doc/Zsh/builtins.yo, Src/params.c, + Test/B02typeset.ztst: fix, document and test "readonly -p" + output for arrays and specials. + + * 35056: Test/A02alias.ztst: turn off PROMPT_SP for interactive + test. + +2015-05-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35057: Etc/FAQ.yo: make URL clickable (should have been + included in 34850) + +2015-05-07 Peter Stephenson <p.stephenson@samsung.com> + + * 35054: Src/params.c, Test/B02typeset.ztst: "readonly -p" + displays unset readonly variables with POSIXBUILTINS. + + * Eric Cook: 35052: Completion/BSD/Command/_bsdconfig, + Completion/BSD/Command/_bsdinstall, + Completion/BSD/Command/_jexec, Completion/BSD/Command/_jls: + new completions. + +2015-05-06 Barton E. Schaefer <schaefer@zsh.org> + + * 35046: Src/lex.c: properly unwind cmdstack when erroring out of + lexing a parameter expansion in braces + +2015-05-06 Peter Stephenson <p.stephenson@samsung.com> + + * c.f. 35041 (Axel Beckert): Doc/Zsh/zle.yo: typo. + +2015-05-06 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 35034: Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo, Doc/Zsh/cond.yo, + Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo, Doc/Zsh/options.yo, + Doc/Zsh/params.yo, Doc/Zsh/redirect.yo, Doc/Zsh/zle.yo: improve + format in the manual (up to Chapter18) + 2015-05-05 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: Config/version.mk, Etc/FAQ.yo: update for diff --git a/Completion/BSD/Command/_bsdconfig b/Completion/BSD/Command/_bsdconfig new file mode 100644 index 000000000..8c7597e0f --- /dev/null +++ b/Completion/BSD/Command/_bsdconfig @@ -0,0 +1,55 @@ +#compdef bsdconfig + +local -a shortcuts +shortcuts=( + 'console:utilities to customize the behavior of the system console' + 'defaultrouter:default router/gateway' + 'diskmgmt:manage disk partitions and/or labels using sade(8)' + 'docsinstall:install/reinstall FreeBSD documentation set(s)' + 'dot:generate a graphviz dot(1) language file(printed on stdout)' + 'groupadd:add groups' + 'groupdel:delete groups' + 'groupedit:edit/view groups' + 'groupmgmt:utilities to add/change/view/delete group accounts' + 'hostname:set hostname/domainname' + 'kern_securelevel:set kern.securelevel variable' + 'mouse:utilities for configuring, exploring, and enabling console mouse support' + 'mouse_disable:disable mouse support' + 'mouse_enable:enable mouse support' + 'mouse_flags:set mouse daemon flags' + 'mouse_port:select mouse port' + 'mouse_type:select mouse type' + 'nameservers:DNS Nameservers menu under networking' + 'netdev:configure network interfaces' + 'networking:utilities for network related settings' + 'packages:browse, install, uninstall, or re-install packaged software' + 'password:set the system administrator (root) password' + 'security:configure various system security settings' + 'startup:configure various aspects of system startup' + 'startup_misc:miscellaneous startup services' + 'startup_rcadd:add directives to rc.conf(5)' + 'startup_rcconf:view/edit directives to rc.conf(5)' + 'startup_rcdelete:delete directives from rc.conf(5)' + 'startup_rcvar:toggle directives on/off' + 'syscons_font:select console font' + 'syscons_keymap:select console keymap' + 'syscons_repeat:set key repeat speed' + 'syscons_saver:select console screensaver' + 'syscons_screenmap:select console screenmap' + 'syscons_ttys:select console TTY type' + 'timezone:set the regional timezone of the local machine' + 'ttys:edit the ttys(5) database with your favorite editor' + 'useradd:add users' + 'userdel:delete users' + 'useredit:edit/view users' + 'usermgmt:utilities to add/edit/view/delete user accounts' +) + +_arguments -s -w -A '-*' : \ + '-d[debug mode]' \ + '-D[send debug info to file]: :{ compset -P 1 +; _files }' \ + '-f[load file as script then exit]: : _files' \ + '-h[print usage then exit]' \ + '-S[secure X11 mode]' \ + '-X[use Xdialog(1)]' \ + '1:bsdconfig(8) menus:(( $shortcuts ))' diff --git a/Completion/BSD/Command/_bsdinstall b/Completion/BSD/Command/_bsdinstall new file mode 100644 index 000000000..e0589d720 --- /dev/null +++ b/Completion/BSD/Command/_bsdinstall @@ -0,0 +1,46 @@ +#compdef bsdinstall + +local -a _bsdinstall_targets +_bsdinstall_targets=( + 'auto:standard interactive installation, including disk partitioning' + "entropy:stores a small amount of data from /dev/random in the new system's root" + 'jail:sets up a new chroot system at destination, suitable for use with jail(8)' + 'script:run an installation script' + "keymap:set the keymap and save to the new system's rc.conf" + 'hostname:set the hostname for the new system' + 'netconfig:configure networking' + 'autopart:run the interactive guided disk partitioner' + 'zfsboot:run the interactive/scriptable ZFS partitioner' + 'scriptedpart:non-interactive partition setup' + 'mount:mount the file systems previously configured by autopart, partedit, or scriptedpart' + 'distfetch:fetches the distributions in DISTRIBUTIONS to BSDINSTALL_DISTDIR from BSDINSTALL_DISTSITE' + 'checksum:verifies the checksums of the distributions listed in DISTRIBUTIONS' + 'distextract:extracts the distributions listed in DISTRIBUTIONS into BSDINSTALL_CHROOT' + "rootpass:interactively invokes passwd(1) in the new system to set the root user's password" + 'adduser:interactively invokes adduser(8) in the new system' + 'time:interactively sets the time, date, and time zone of the new system' + 'services:queries the user for the system daemons to begin at system startup' + 'config:installs the configuration files destined for the new system' +) + +local context state state_descr line +typeset -A val_args +_arguments -A '-*' : \ + '-D[installation log file]: : _files' \ + '1: :->targets' \ + '*: :->args' + +case $state in + targets) _describe targets _bsdinstall_targets;; + args) + shift words + [[ $words[1] == '-D' ]] && shift 2 words + + case $words[1] in + jail) _files -/;; + script) _files;; + scriptedpart) _message "$words[1] parameters";; + *) _message "nothing to complete"; return 1;; + esac + ;; +esac diff --git a/Completion/BSD/Command/_jexec b/Completion/BSD/Command/_jexec new file mode 100644 index 000000000..f065ea1e0 --- /dev/null +++ b/Completion/BSD/Command/_jexec @@ -0,0 +1,19 @@ +#compdef jexec + +_jexec_normal() { + local PATH=$PATH + # relative paths are relative to the jail's root + path=( "$(command jls -j $words[1] path)"/$^path ) + shift 1 words; (( CURRENT-- )) + _normal +} + +_jexec() { + _arguments -s -w -A "-*" : \ + '(-U)-u[host environment user whom command runs as]:host user:_users' \ + '(-u)-U[jail environment user whom command runs as]:jail user:_users' \ + '1:jail:_jails' \ + '*:: : _jexec_normal' +} + +_jexec "$@" diff --git a/Completion/BSD/Command/_jls b/Completion/BSD/Command/_jls new file mode 100644 index 000000000..a6f8a7eb6 --- /dev/null +++ b/Completion/BSD/Command/_jls @@ -0,0 +1,19 @@ +#compdef jls + +local curcontext=$curcontext state state_descr line +typeset -A opt_args + +_arguments -C -s -w -A '-*' : \ + '-d[include diying jails]' \ + '-h[print header line]' \ + "-N[print jail's name instead of numeric ID]" \ + '-n[print parameters in ``name=value'\'\'' format]' \ + '-q[quote parameter value when it contains whitespace, quotes or empty string]' \ + '-s[print parameters suitable for passing to jail(8)]' \ + '-v[print a multiple-line summary per jail]' \ + '-j[the jid or name of the jail to list]:jail:_jails' \ + '*: :->parameters' + +if [[ $state == parameters ]]; then + _values -w -S ' ' 'jail parameter' ${${${(f)"$(sysctl -N security.jail.param)"}%.#}##security.jail.param.#} +fi diff --git a/Completion/BSD/Type/.distfiles b/Completion/BSD/Type/.distfiles new file mode 100644 index 000000000..f03668b3a --- /dev/null +++ b/Completion/BSD/Type/.distfiles @@ -0,0 +1,2 @@ +DISTFILES_SRC=' +' diff --git a/Completion/BSD/Type/_jails b/Completion/BSD/Type/_jails index 36bffeceb..89e34ba4f 100644 --- a/Completion/BSD/Type/_jails +++ b/Completion/BSD/Type/_jails @@ -1,5 +1,33 @@ #autoload -jails=( ${${${${(f)"$(_call_program jails jls -n)"}##*jid=}/ name=/:}%% *} ) +# Options: +# +# -0 include jid 0 as a match for the host system +# -o param jail parameter to complete instead of jid - +# e.g. name, path, ip4.addr, host.hostname -_describe -t jails jail jails "$@" +local addhost host param desc=1 +local -a jails args expl +zparseopts -D -K -E 0=addhost o:=param +param=${param[2]:-name} + +jails=( ${${(f)"$(_call_program jails jls $param name)"}/ /:} ) +case $param in + jid) host=0 ;; + name) + host=0 + desc=0 + ;; + path) + host=/ + args=( -M 'r:|/=* r:|=*' ) + ;; + ip4.addr) args=( -M 'r:|.=* r:|=*' ) ;; +esac +[[ -n $addhost && -n $host ]] && jails+=( "$host:$HOST" ) + +if (( desc )); then + _describe -t jails jail jails "$@" "$args[@]" +else + _wanted jails expl jail compadd "$@" "$args[@]" - ${jails%:*} +fi diff --git a/Completion/Base/Utility/_store_cache b/Completion/Base/Utility/_store_cache index 8feaee6f7..86e72e9a9 100644 --- a/Completion/Base/Utility/_store_cache +++ b/Completion/Base/Utility/_store_cache @@ -46,15 +46,8 @@ if zstyle -t ":completion:${curcontext}:" use-cache; then for var; do case ${(Pt)var} in (*readonly*) ;; - (*(association|array)*) - # Dump the array as a here-document to reduce parsing overhead - # when reloading the cache with "source" from _retrieve_cache - print -r "$var=( "'"${(zQ)$(<<\EO:'"$var" - print -r "${(kv@Pqq)^^var}" - print -r "EO:$var" - print -r ')}" )' - ;; - (*) print -r "$var=${(Pqq)^^var}";; + (*(association|array)*) print -r "$var=( ${(kv@Pqq)^^var} )";; + (*) print -r "$var=${(Pqq)^^var}";; esac done >! "$_cache_dir/$_cache_ident" else diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum index a6983283c..f4538060e 100644 --- a/Completion/Redhat/Command/_yum +++ b/Completion/Redhat/Command/_yum @@ -173,20 +173,34 @@ yum_repos() { # Completion function for install (( $+functions[_yum_install] )) || _yum_install() { - _yum_available_pkgs - compadd "$@" -a -- _available_pkgs + if ! [[ $PREFIX == */* ]]; then + _yum_available_pkgs + fi + + local ret=1 + _tags files packages + while _tags; do + if _requested files; then + compadd "$@" -a -- _available_pkgs + fi + if _requested packages; then + _call_function - _yum_localinstall + fi + (( ret )) || break + done + return ret } # Completion function for localinstall (( $+functions[_yum_localinstall] )) || _yum_localinstall() { - _files -g '(#i)*.rpm(-.)' + _files -/ -g '(#i)*.rpm(-.)' } # Completion function for localupdate (( $+functions[_yum_localupdate] )) || _yum_localupdate() { - _files -g '(#i)*.rpm(-.)' + _files -/ -g '(#i)*.rpm(-.)' } # Completion function for update/upgrade diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 8e4bd82af..ee9f7d910 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -123,8 +123,7 @@ case $state in # Output target again indicating its the default one. print -n "'${default_target}:(Default target) ' " ;; - (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time: - *) + (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time:*) ;; (*) # Return target and description diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz index 132c6e31d..6787f41e2 100644 --- a/Completion/Unix/Command/_baz +++ b/Completion/Unix/Command/_baz @@ -6,13 +6,13 @@ local baz_version local hide_short # ask the user which version of baz this is -if ! zstyle -s ":completion:${curcontext}" baz-version baz_version; then +if ! zstyle -s ":completion:${curcontext}:" baz-version baz_version; then # ask baz instead baz_version="${${$($BAZ --version)#baz Bazaar version }%% \(thelove@canonical.com*}" fi # test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then +if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then case $hide_short in true|yes|on|1) hide_short='!' ;; *) hide_short='' ;; diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp index 4c4dea2e9..7087b4e6c 100644 --- a/Completion/Unix/Command/_cp +++ b/Completion/Unix/Command/_cp @@ -13,7 +13,7 @@ if _pick_variant gnu=GNU unix --version; then '-H[follow command-line symbolic links]' \ '(-l --link)'{-l,--link}'[link files instead of copying]' \ '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \ - (-n --no-clobber -i --interactive){-n,--no-clobber}"[don't overwrite an existing file]" \ + '(-n --no-clobber -i --interactive)'{-n,--no-clobber}"[don't overwrite an existing file]" \ '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \ '-p[same as --preserve=mode,ownership,timestamps]' \ '--preserve=-[preserve specified attributes]:: :_values -s , attribute mode timestamps ownership links context xattr all' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 979e3e76f..4403a48a8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -714,12 +714,14 @@ _git-diff () { local curcontext=$curcontext state line ret=1 declare -A opt_args - local -a diff_options + local -a diff_options diff_stage_options __git_setup_diff_options + __git_setup_diff_stage_options _arguments -w -C -s \ $* \ $diff_options \ + $diff_stage_options \ '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ '*:: :->from-to-file' && ret=0 @@ -1081,12 +1083,10 @@ _git-log () { local -a log_options revision_options diff_options __git_setup_log_options __git_setup_revision_options - __git_setup_diff_options _arguments -w -C -s \ $log_options \ $revision_options \ - $diff_options \ '-L+[trace the evolution of a line range or regex within a file]:range' \ '(-)--[start file arguments]' \ '*:: :->commit-range-or-file' && ret=0 @@ -1484,10 +1484,9 @@ _git-show () { local curcontext=$curcontext state line ret=1 typeset -A opt_args - local -a log_options revision_options diff_options + local -a log_options revision_options __git_setup_log_options __git_setup_revision_options - __git_setup_diff_options _arguments -w -C -s \ $log_options \ @@ -1794,7 +1793,7 @@ _tig () { (( $+functions[_git-config] )) || _git-config () { local name_arg value_arg - local curcontext=$curcontext state line ret=1 + local curcontext=$curcontext state line expl ret=1 declare -A opt_args if (( words[(I)--get-regexp] )); then @@ -2554,7 +2553,7 @@ _git-config () { options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' && ret=0 ;; (gettable-option) - _describe -t git-options option \ + _wanted git-options expl option compadd -M 'r:|.=* r:|=*' - \ ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} && ret=0 ;; (gettable-colorbool-option) @@ -2948,7 +2947,8 @@ _git-fast-export () { '--progress=[insert progress statements]: :__git_guard_number interval' \ '--signed-tags=[specify how to handle signed tags]:action:((verbatim\:"silently export" warn\:"export, but warn" - strip\:"export unsigned tags instead" + warn-strip\:"export as unsigned tags, but warn" + strip\:"export as unsigned tags instead" abort\:"abort on signed tags (default)"))' \ '--tag-of-filtered-object=[specify how to handle tags whose tagged object is filtered out]:action:((abort\:"abort on such tags" drop\:"omit such tags" @@ -3733,7 +3733,9 @@ _git-send-email () { '( --no-validate)--validate[perform sanity checks on patches]' \ '(--validate )--no-validate[do not perform sanity checks on patches]' \ '--force[send emails even if safety checks would prevent it]' \ - '*: :_files' + '*: : _alternative -O expl + "files:file:_files" + "commits:recent commit object name:__git_commit_objects_prefer_recent"' } (( $+functions[_git-svn] )) || @@ -4341,11 +4343,13 @@ _git-cat-file () { (( $+functions[_git-diff-files] )) || _git-diff-files () { - declare -a revision_options + local -a revision_options diff_stage_options __git_setup_revision_options + __git_setup_diff_stage_options _arguments -w -S -s \ $revision_options \ + $diff_stage_options \ ': :__git_changed-in-working-tree_files' \ ': :__git_changed-in-working-tree_files' \ '*: :__git_changed-in-working-tree_files' @@ -5532,7 +5536,7 @@ __git_stashes () { local expl declare -a stashes - stashes=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */}) + stashes=(${(f)"$(_call_program stashes git stash list --pretty=format:%gd 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 _wanted stashes expl stash compadd "$@" -a - stashes @@ -5585,7 +5589,7 @@ __git_remote_branch_names () { branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names expl 'remote branch name' compadd "$@" -a - branch_names + _wanted remote-branch-names expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names } (( $+functions[__git_remote_branch_names_noprefix] )) || @@ -5596,7 +5600,12 @@ __git_remote_branch_names_noprefix () { branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names-noprefix expl 'remote branch name' compadd "$@" -a - branch_names + _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names +} + +(( $+functions[__git_commit_objects_prefer_recent] )) || +__git_commit_objects_prefer_recent () { + __git_recent_commits || __git_commit_objects } (( $+functions[__git_commits] )) || @@ -5609,15 +5618,21 @@ __git_commits () { _alternative \ "heads::__git_heads $sopts" \ "commit-tags::__git_commit_tags $sopts" \ - 'commit-objects::__git_commit_objects' + 'commit-objects::__git_commit_objects_prefer_recent' } (( $+functions[__git_heads] )) || __git_heads () { + __git_heads_local + __git_heads_remote +} + +(( $+functions[__git_heads_local] )) || +__git_heads_local () { local gitdir expl start declare -a heads - heads=(${${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname)"' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do @@ -5626,7 +5641,17 @@ __git_heads () { [[ -f $gitdir/refs/stash ]] && heads+=stash fi - _wanted heads expl head compadd "$@" -a - heads + _wanted heads-local expl "local head" compadd -M 'r:|/=**' "$@" -a - heads +} + +(( $+functions[__git_heads_remote] )) || +__git_heads_remote () { + local gitdir expl start + declare -a heads + + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) + + _wanted heads-remote expl "remote head" compadd -M 'r:|/=**' "$@" -a - heads } (( $+functions[__git_commit_objects] )) || @@ -5634,29 +5659,47 @@ __git_commit_objects () { local gitdir expl start declare -a commits + # Abort if the argument does not match a commit hash (including empty). + [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]] || return 1 + # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}} + commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"}) __git_command_successful $pipestatus || return 1 - _describe -V -t commits 'commit object name' commits || _guard '[[:xdigit:]](#c,40)' 'commit object name' + _describe -V -t commits 'commit object name' commits } (( $+functions[__git_recent_commits] )) || __git_recent_commits () { local gitdir expl start declare -a descr tags heads commits - local i j k + local i j k ret + integer distance_from_head # Careful: most %d will expand to the empty string. Quote properly! - : "${(A)commits::=${(@f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s')"}}" + # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. + commits=("${(f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}") __git_command_successful $pipestatus || return 1 for i j k in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - descr+=("$i:[$i] $k") + if (( distance_from_head == 0 )); then + descr+=($i:"[HEAD] $k") + elif (( distance_from_head == 1 )); then + descr+=($i:"[HEAD^] $k") + elif (( distance_from_head == 2 )); then + descr+=($i:"[HEAD^^] $k") + elif (( distance_from_head < 10 )); then + descr+=($i:"[HEAD~$distance_from_head] $k") + else + descr+=($i:"[HEAD~$distance_from_head] $k") + fi + (( ++distance_from_head )) + j=${${j# \(}%\)} # strip leading ' (' and trailing ')' + j=${j/ ->/,} # Convert " -> master, origin/master". for j in ${(s:, :)j}; do if [[ $j == 'tag: '* ]] ; then tags+=( ${j#tag: } ) @@ -5673,7 +5716,8 @@ __git_recent_commits () { expl=() _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 expl=() - _describe -2Vx -t commits 'commit object name' descr && ret=0 + _describe -Vx -t commits 'recent commit object name' descr && ret=0 + return $ret } (( $+functions[__git_blob_objects] )) || @@ -6214,14 +6258,20 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' + '(-c,--cc)'{-c,--cc}'[combined diff format for merge commits]' + + # TODO: --output is undocumented. + '--output[undocumented]:undocumented') +} + +(( $+functions[__git_setup_diff_stage_options] )) || +__git_setup_diff_stage_options () { + diff_stage_options=( '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-1,--base}'[diff against "base" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-2,--ours}'[diff against "our branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-3,--theirs}'[diff against "their branch" version]' '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)-0[omit diff output for unmerged entries]' - '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-c,--cc}'[compare "our branch", "their branch" and working tree files]' - - # TODO: --output is undocumented. - '--output[undocumented]:undocumented') + ) } (( $+functions[__git_setup_revision_options] )) || diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip index bfa7d995b..1e3949148 100644 --- a/Completion/Unix/Command/_ip +++ b/Completion/Unix/Command/_ip @@ -531,6 +531,8 @@ args=( ) _regex_words options "ip options" \ + '-h*uman:output statistics with human readable values' \ + '-i*ec:print human readable rates in IEC units (ie. 1K = 1024)' \ '-s*tatistics:output statistics' \ '-f*amily:select protocol family:$subcmd_family' \ '-4:IPv4' \ diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 0b35b7cdd..694f506c3 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -25,7 +25,7 @@ case $basename in ltype=gnu ;; - (*illegal option*) + (*"illegal option"*) if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then ltype=bsd else diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 225c0af85..c14a34c58 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -65,7 +65,7 @@ _make-parseMakefile () { do case "$input " in # VARIABLE = value OR VARIABLE ?= value - ([[:alnum:]][[:alnum:]_]#[ $TAB]#(\?|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#(\?|)=*) var=${input%%[ $TAB]#(\?|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -74,7 +74,7 @@ _make-parseMakefile () { # VARIABLE := value OR VARIABLE ::= value # Evaluated immediately - ([[:alnum:]][[:alnum:]_]#[ $TAB]#:(:|)=*) + ([[:alnum:]][[:alnum:]_]#[" "$TAB]#:(:|)=*) var=${input%%[ $TAB]#:(:|)=*} val=${input#*=} val=${val##[ $TAB]#} @@ -97,7 +97,7 @@ _make-parseMakefile () { ;; # Include another makefile - (${~incl} *) + (${~incl}" "*) local f=${input##${~incl} ##} if [[ $incl == '.include' ]] then diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 3af55a379..d3dcd1812 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -8,7 +8,7 @@ arguments=('-P[parent process id]:parent process id:->ppid' '-F[match only in process in pidfile]:files:_files' '-g[match only in process group ids]:group:->pgid' '-G[match only real group id]:group:_groups' - '-j[match only in processes inside jails]:jail id:->jid' + '-j[match only in processes inside jails]:jail id:_sequence _jails -0 -o jid' '-J[match only in project ids]:project id:->projid' '-M[extract the name list from the specified core]:files:_files' '-N[extract the name list from the specified system]:files:_files' @@ -93,16 +93,6 @@ case $state in _wanted sid expl 'session id' compadd -S ',' -q -F used $sid ;; - (jid) - compset -P '*,' - - local -a used jid - used=(${(s:,:)IPREFIX}) - jid=(${(uon)$(ps -ax -o jid=)}) - - _wanted jid expl 'jail id' compadd -S ',' -q -F used $jid - ;; - (ppid) compset -P '*,' diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index 5d7b84e28..4edcd1e57 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -9,7 +9,7 @@ typeset -A opt_args local -a args local exclusions php_suffix -zstyle -s ":completion:$curcontext" suffixes php_suffix '|' || php_suffix='php|phar' +zstyle -s ":completion:${curcontext}:" suffixes php_suffix '|' || php_suffix='php|phar' local php_files=":PHP file:_files -g '*.($php_suffix)(-.)'" if _pick_variant php5=PHP\ 5 php4 --version; then diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 925f48390..e557b27b9 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -160,7 +160,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $word _wanted -C option-k-1 properties expl 'property' _sequence -s , _ps_props -s - && return ;; *G) _sequence -s , _groups && return ;; - *J) _sequence -s , _jails && return ;; + *J) _sequence _jails -0 && return ;; *[MNW]) _files && return ;; *t) _wanted -C option-t-1 ttys expl tty _sequence -s , \ diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index dedb9ceda..2fb4a915b 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -31,7 +31,7 @@ _arguments -C -s -S "$args[@]" \ '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \ '(1 * -)-h[display help information]' \ '-i[inspect interactively after running script]' \ - '(1 -)-m[run library module as a script (terminates option list)]:module:_python_modules' \ + '(1 -)-m+[run library module as a script (terminates option list)]:module:_python_modules' \ '-O[optimize generated bytecode slightly]' \ '-OO[remove doc-strings in addition to the -O optimizations]' \ "-s[don't add user site directory to sys.path]" \ diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 597f2325c..188a81367 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -96,7 +96,7 @@ _svn () { ) ;; (mergeinfo) - args[(r)--show-revs:arg:]=( '--show-revs:revisions:(merged eligible)' ) + args[(r)--show-revs:arg:]=( '--show-revs=:revisions:(merged eligible)' ) ;; (propget|propedit) args+=( diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index ce5852453..1e99ac013 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -23,7 +23,7 @@ local _tar_cmd tf tmp tmpb del index if _pick_variant gnu=GNU unix --version; then case "$($service --version)" in - (tar \(GNU tar\) (#b)([0-9.-]##)*) + ("tar (GNU tar) "(#b)([0-9.-]##)*) autoload -z is-at-least is-at-least 1.14.91 "$match[1]" || _cmd_variant[$service]="gnu-old" ;; diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla index 358a6a736..1e4cdd8d9 100644 --- a/Completion/Unix/Command/_tla +++ b/Completion/Unix/Command/_tla @@ -6,7 +6,7 @@ local tla_version local hide_short # ask the user which version of tla this is -if ! zstyle -s ":completion:${curcontext}" tla-version tla_version; then +if ! zstyle -s ":completion:${curcontext}:" tla-version tla_version; then # ask tla instead tla_version="$($TLA --version)" if [[ "${${(f)tla_version}[1]}" == The\ GNU\ Arch\ Revision\ Control\ System\ \(tla\)\ (#b)([0-9.]##) ]]; then @@ -18,7 +18,7 @@ if ! zstyle -s ":completion:${curcontext}" tla-version tla_version; then fi # test whether to hide short options from completion -if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then +if zstyle -s ":completion:${curcontext}:" hide-shortopts hide_short; then case $hide_short in true|yes|on|1) hide_short='!' ;; *) hide_short='' ;; diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 021054d47..007671be8 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -4,7 +4,7 @@ _vim_files () { case $PREFIX in (+*) _files -P './' $* && return 0 ;; - (scp|http(|s)|(|s)ftp):*) _urls ;; + ((scp|http(|s)|(|s)ftp):*) _urls ;; (*) _files $* ;; esac case $PREFIX in diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 22d2aaeba..423563c0d 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -25,7 +25,7 @@ return 1 _call_whatis() { case "$(whatis --version)" in - (whatis from *) + ("whatis from "*) local -A args zparseopts -D -A args s: r: apropos "${args[-r]:-"$@"}" | fgrep "($args[-s]" diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls index 97b1a4402..6f23803ed 100644 --- a/Completion/Unix/Type/_urls +++ b/Completion/Unix/Type/_urls @@ -75,7 +75,7 @@ fi scheme="$match[1]" case "$scheme" in - http(|s)|(|s)ftp|scp|gopher) + (http(|s)|(|s)ftp|scp|gopher) if ! compset -P //; then _wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" // return diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr index 9d9323c69..b0851569e 100644 --- a/Completion/X/Command/_xrandr +++ b/Completion/X/Command/_xrandr @@ -51,7 +51,7 @@ _arguments -C \ case $state in value) case $words[CURRENT-1] in - (scaling* mode) + (scaling*" mode") _description value expl "output property 'scaling mode'" compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0 ;; diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter index fcca4bf84..3955cb7a4 100644 --- a/Completion/Zsh/Context/_brace_parameter +++ b/Completion/Zsh/Context/_brace_parameter @@ -143,6 +143,7 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then "@:double-quoted splitting of scalars" "A:create array parameter" "a:sort in array index order (with O to reverse)" + "b:backslash quote pattern characters only" "c:count characters in an array (with \${(c)#...})" "C:capitalize words" "D:perform directory name abbreviation" diff --git a/Config/version.mk b/Config/version.mk index d04d57d87..ece66f6e1 100644 --- a/Config/version.mk +++ b/Config/version.mk @@ -27,5 +27,5 @@ # This must also serve as a shell script, so do not add spaces around the # `=' signs. -VERSION=5.0.7-dev-2 -VERSION_DATE='May 5, 2015' +VERSION=5.0.7-dev-4 +VERSION_DATE='May 27, 2015' diff --git a/Doc/Makefile.in b/Doc/Makefile.in index a420781ee..7645f42f7 100644 --- a/Doc/Makefile.in +++ b/Doc/Makefile.in @@ -41,8 +41,7 @@ LN_S = @LN_S@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi DVIPS = dvips -TEXI2HTML = @TEXI2HTML@ --output . --ifinfo --split=chapter --node-files \ - --init-file texi2html.conf +TEXI2HTML = @TEXI2HTML@ .SUFFIXES: .yo .1 @@ -163,7 +162,8 @@ html: zsh_toc.html .PHONY: html zsh_toc.html: $(sdir)/zsh.texi texi2html.conf - $(TEXI2HTML) $(sdir)/zsh.texi + $(TEXI2HTML) --output . --ifinfo --split=chapter --node-files \ + --init-file texi2html.conf $(sdir)/zsh.texi zshall.1: zsh.yo @case $@ in \ @@ -252,8 +252,12 @@ version.yo: $(sdir_top)/Config/version.mk ) > $(sdir)/version.yo texi2html.conf: $(sdir_top)/Config/version.mk - echo '$$PRE_BODY_CLOSE = "<font size=\"-1\">Zsh version $(VERSION), released on $(VERSION_DATE).</font>";' \ - > $@ + d=`echo $(VERSION_DATE)`; \ + v="<font size=\"-1\">Zsh version $(VERSION), released on $$d.</font>"; \ + case '$(TEXI2HTML)' in \ + *texi2any*) echo "set_from_init_file('PRE_BODY_CLOSE','$$v');" ;; \ + *) echo "\$$PRE_BODY_CLOSE = '$$v';" ;; \ + esac > $@ Zsh/modlist.yo: $(MODDOCSRC) ( \ diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo index 5c334ce9c..1dcd18cad 100644 --- a/Doc/Zsh/arith.yo +++ b/Doc/Zsh/arith.yo @@ -7,7 +7,8 @@ cindex(arithmetic evaluation) cindex(evaluation, arithmetic) findex(let, use of) The shell can perform integer and floating point arithmetic, either using -the builtin tt(let), or via a substitution of the form tt($((...))). For +the builtin tt(let), or via a substitution of the form +tt($LPAR()LPAR())var(...)tt(RPAR()RPAR()). For integers, the shell is usually compiled to use 8-byte precision where this is available, otherwise precision is 4 bytes. This can be tested, for example, by giving the command `tt(print - $(( 12345678901 )))'; if the @@ -40,7 +41,7 @@ cindex(arithmetic base) cindex(bases, in arithmetic) Integers can be in bases other than 10. A leading `tt(0x)' or `tt(0X)' denotes hexadecimal and a leading -`tt(0b)' or `tt(0B) binary. +`tt(0b)' or `tt(0B)' binary. Integers may also be of the form `var(base)tt(#)var(n)', where var(base) is a decimal number between two and thirty-six representing the arithmetic base and var(n) @@ -100,8 +101,8 @@ shown may vary). pindex(C_BASES, use of) pindex(OCTAL_ZEROES, use of) -If the tt(C_BASES) option is set, hexadecimal numbers in the standard C -format, for example tt(0xFF) instead of the usual `tt(16#FF)'. If the +If the tt(C_BASES) option is set, hexadecimal numbers are output in the standard C +format, for example `tt(0xFF)' instead of the usual `tt(16#FF)'. If the option tt(OCTAL_ZEROES) is also set (it is not by default), octal numbers will be treated similarly and hence appear as `tt(077)' instead of `tt(8#77)'. This option has no effect on the output of bases other than @@ -175,7 +176,7 @@ endsitem() Note the precedence of exponentiation in both cases is below that of unary operators, hence `tt(-3**2)' evaluates as `tt(9)', not -tt(-9). Use parentheses where necessary: `tt(-(3**2))'. This is +`tt(-9)'. Use parentheses where necessary: `tt(-(3**2))'. This is for compatibility with other shells. cindex(mathematical functions, use of) @@ -190,12 +191,12 @@ functions. An expression of the form `tt(##)var(x)' where var(x) is any character sequence such as `tt(a)', `tt(^A)', or `tt(\M-\C-x)' gives the value of -this character and an expression of the form `tt(#)var(foo)' gives the -value of the first character of the contents of the parameter var(foo). +this character and an expression of the form `tt(#)var(name)' gives the +value of the first character of the contents of the parameter var(name). Character values are according to the character set used in the current locale; for multibyte character handling the option tt(MULTIBYTE) must be -set. Note that this form is different from `tt($#)var(foo)', a standard -parameter substitution which gives the length of the parameter var(foo). +set. Note that this form is different from `tt($#)var(name)', a standard +parameter substitution which gives the length of the parameter var(name). `tt(#\)' is accepted instead of `tt(##)', but its use is deprecated. Named parameters and subscripted arrays can be referenced by name within an diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index c4acf7672..a2c03bcc4 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -5,7 +5,8 @@ sect(Shell Builtin Commands) )\ def(prefix)(1)(\ item(tt(ARG1) var(simple command))( -See noderef(Precommand Modifiers). +See ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ +ifnzman(noderef(Precommand Modifiers)). )\ )\ def(alias)(2)(\ @@ -95,7 +96,7 @@ which may have effects on shell parameters. A zero exit status is returned. findex(alias) cindex(aliases, defining) cindex(aliases, listing) -item(tt(alias) [ {tt(PLUS()|tt(-))}tt(gmrsL) ] [ var(name)[tt(=)var(value)] ... ])( +item(tt(alias) [ {tt(PLUS())|tt(-)}tt(gmrsL) ] [ var(name)[tt(=)var(value)] ... ])( For each var(name) with a corresponding var(value), define an alias with that value. A trailing space in var(value) causes the next word to be checked for alias expansion. If the tt(-g) flag is present, @@ -135,8 +136,8 @@ alias in a manner suitable for putting in a startup script. The exit status is nonzero if a var(name) (with no var(value)) is given for which no alias has been defined. -For more on aliases, include common problems, -ifzman(see the section ALIASING in zmanref(zshmisc))\ +For more on aliases, include common problems, see +ifzman(the section ALIASING in zmanref(zshmisc))\ ifnzman(noderef(Aliasing)). ) findex(autoload) @@ -273,7 +274,8 @@ searched instead of that in tt($path). With the tt(-v) flag, tt(command) is similar to tt(whence) and with tt(-V), it is equivalent to tt(whence -v). -See also noderef(Precommand Modifiers). +See also ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ +ifnzman(noderef(Precommand Modifiers)). ) module(comparguments)(zsh/computil) module(compcall)(zsh/compctl) @@ -353,7 +355,7 @@ setting here. For example, if tt(EXTENDED_GLOB) is not active, the pattern tt(^) is ineffective even if `tt(disable -p "^")' has not been issued. The list below indicates any option settings that restrict the use of the pattern. It should be noted that -setting tt(SH_GLOB) has a wider effect then merely disabling patterns +setting tt(SH_GLOB) has a wider effect than merely disabling patterns as certain expressions, in particular those involving parentheses, are parsed differently. @@ -361,6 +363,7 @@ The following patterns may be disabled; all the strings need quoting on the command line to prevent them from being interpreted immediately as patterns and the patterns are shown below in single quotes as a reminder. + startitem() item(tt('?'))( The pattern character tt(?) wherever it occurs, including when preceding @@ -370,7 +373,7 @@ item(tt('*'))( The pattern character tt(*) wherever it occurs, including recursive globbing and when preceding a parenthesis with tt(KSH_GLOB). ) -item('LSQUARE()')( +item(tt('LSQUARE()'))( Character classes. ) item(tt('<') (tt(NO_SH_GLOB)))( @@ -548,8 +551,8 @@ fno The two functions tt(fni) and tt(fno) are defined with sticky tt(sh) emulation. tt(fno) is then executed, causing options associated -with emulations to be set to their values in tt(sh). tt(fni) then -calls tt(fno); because tt(fno) is also marked for sticky tt(sh) +with emulations to be set to their values in tt(sh). tt(fno) then +calls tt(fni); because tt(fni) is also marked for sticky tt(sh) emulation, no option changes take place on entry to or exit from it. Hence the option tt(cshnullglob), turned off by tt(sh) emulation, will be turned on within tt(fni) and remain on on return to tt(fno). On exit @@ -615,12 +618,14 @@ the same as if the commands had been executed directly by the shell; if there are no var(args) or they contain no commands (i.e. are an empty string or whitespace) the return status is zero. ) -item(tt(exec) [ tt(-cl) ] [ tt(-a) var(argv0) ] [ var(command) [ var(arg) ... ]])( +item(tt(exec) [ tt(-cl) ] [ tt(-a) var(argv0) ] [ var(command) [ var(arg) ... ] ])( Replace the current shell with an external var(command) rather than forking. With tt(-c) clear the environment; with tt(-l) prepend tt(-) to the tt(argv[0]) string of the command executed (to simulate a login shell); with tt(-a) var(argv0) set the tt(argv[0]) string of the command -executed. See noderef(Precommand Modifiers). +executed. +See ifzman(the section `Precommand Modifiers' in zmanref(zshmisc))\ +ifnzman(noderef(Precommand Modifiers)). cindex(redirection, current shell's I/O) If var(command) is omitted but any redirections are specified, @@ -656,10 +661,11 @@ Do nothing and return an exit status of 1. findex(fc) cindex(history, editing) cindex(editing history) +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( ))) xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ]) -xitem(tt(fc) tt(-l) [ tt(-nrdfEiD) ] [ tt(-t) var(timefmt) ] [ tt(-m) var(match) ]) -xitem(tt( )[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ]) -xitem(tt(fc) tt(-p) [ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ]) +xitem(tt(fc -l )[ tt(-nrdfEiD) ] [ tt(-t) var(timefmt) ] [ tt(-m) var(match) ]) +xitem(SPACES()[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ]) +xitem(tt(fc -p )[ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ]) xitem(tt(fc) tt(-P)) item(tt(fc) tt(-ARWI) [ var(filename) ])( The tt(fc) command controls the interactive history mechanism. Note @@ -775,13 +781,13 @@ Bring each specified var(job) in turn to the foreground. If no var(job) is specified, resume the current job. ) findex(float) -item(tt(float) [ {tt(PLUS())|tt(-)}tt(EFHghlprtux) ] [ tt(-LRZ) [ var(n) ]] \ -[ var(name)[tt(=)var(value)] ... ])( +item(tt(float) [ {tt(PLUS())|tt(-)}tt(Hghlprtux) ] \ +[ {tt(PLUS())|tt(-)}tt(EFLRZ) [ var(n) ] ] [ var(name)[tt(=)var(value)] ... ])( Equivalent to tt(typeset -E), except that options irrelevant to floating point numbers are not permitted. ) findex(functions) -xitem(tt(functions) [ {tt(PLUS())|tt(-)}tt(UXkmtTuz) ] [ var(name) ... ]) +xitem(tt(functions) [ {tt(PLUS())|tt(-)}tt(UkmtTuz) ] [ var(name) ... ]) xitem(tt(functions -M) var(mathfn) [ var(min) [ var(max) [ var(shellfn) ] ] ]) xitem(tt(functions -M) [ tt(-m) var(pattern) ... ]) item(tt(functions +M) [ tt(-m) ] var(mathfn) ... )( @@ -834,7 +840,7 @@ cindex(line, reading) cindex(reading a line) item(tt(getln) [ tt(-AclneE) ] var(name) ...)( Read the top value from the buffer stack and put it in -the shell parameter tt(name). Equivalent to +the shell parameter var(name). Equivalent to tt(read -zr). ) findex(getopts) @@ -922,8 +928,8 @@ the form of a call to hash. ) alias(history)(fc -l) findex(integer) -item(tt(integer) [ {tt(PLUS())|tt(-)}tt(Hghilprtux) ] \ -[ tt(-LRZ) [ var(n) ]] [ var(name)[tt(=)var(value)] ... ])( +item(tt(integer) [ {tt(PLUS())|tt(-)}tt(Hghlprtux) ] \ +[ {tt(PLUS())|tt(-)}tt(LRZi) [ var(n) ] ] [ var(name)[tt(=)var(value)] ... ])( Equivalent to tt(typeset -i), except that options irrelevant to integers are not permitted. ) @@ -1058,8 +1064,8 @@ shell starts in a mode emulating another shell. It can be made available with the command `tt(zmodload -F zsh/rlimits b:limit)'. ) findex(local) -item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFHUahlprtux) ] \ -[ tt(-LRZi) [ var(n) ]] [ var(name)[tt(=)var(value)] ] ...)( +item(tt(local) [ {tt(PLUS())|tt(-)}tt(AHUahlprtux) ] \ +[ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ] [ var(name)[tt(=)var(value)] ... ])( Same as tt(typeset), except that the options tt(-g), and tt(-f) are not permitted. In this case the tt(-x) option does not force the use of tt(-g), i.e. exported variables will be local to functions. @@ -1078,12 +1084,12 @@ Same as tt(exit), except that it only works in a login shell. ) prefix(noglob) findex(popd) -item(tt(popd) [ [-q] {tt(PLUS())|tt(-)}var(n) ])( +item(tt(popd) [ tt(-q) ] [ {tt(PLUS())|tt(-)}var(n) ])( Remove an entry from the directory stack, and perform a tt(cd) to the new top directory. With no argument, the current top entry is removed. An argument of the form `tt(PLUS())var(n)' identifies a stack entry by counting from the left of the list shown by the tt(dirs) command, -starting with zero. An argument of the form tt(-n) counts from the right. +starting with zero. An argument of the form tt(-)var(n) counts from the right. pindex(PUSHD_MINUS, use of) If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' and `tt(-)' in this context are swapped. @@ -1094,8 +1100,8 @@ and the new directory stack is not printed. This is useful for calls to tt(popd) that do not change the environment seen by an interactive user. ) findex(print) -xitem(tt(print) [ tt(-abcDilmnNoOpPrsSz) ] [ tt(-u) var(n) ] [ tt(-f) var(format) ] [ tt(-C) var(cols) ]) -item( [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])( +xitem(tt(print )[ tt(-abcDilmnNoOpPrsSz) ] [ tt(-u) var(n) ] [ tt(-f) var(format) ] [ tt(-C) var(cols) ]) +item(SPACES()[ tt(-R) [ tt(-en) ]] [ var(arg) ... ])( With the `tt(-f)' option the arguments are printed as described by tt(printf). With no flags or with the flag `tt(-)', the arguments are printed on the standard output as described by tt(echo), with the following differences: @@ -1117,7 +1123,7 @@ tt(-c) and tt(-C) options. item(tt(-b))( Recognize all the escape sequences defined for the tt(bindkey) command, see -ifzman(zmanref(zshzle))\ +ifzman(the section `Zle Builtins' in zmanref(zshzle))\ ifnzman(noderef(Zle Builtins))\ . ) @@ -1204,13 +1210,13 @@ item(tt(printf) var(format) [ var(arg) ... ])( Print the arguments according to the format specification. Formatting rules are the same as used in C. The same escape sequences as for tt(echo) are recognised in the format. All C conversion specifications ending in -one of csdiouxXeEfgGn are handled. In addition to this, `tt(%b)' can be +one of tt(csdiouxXeEfgGn) are handled. In addition to this, `tt(%b)' can be used instead of `tt(%s)' to cause escape sequences in the argument to be recognised and `tt(%q)' can be used to quote the argument in such a way that allows it to be reused as shell input. With the numeric format specifiers, if the corresponding argument starts with a quote character, the numeric value of the following character is used as the number to -print otherwise the argument is evaluated as an arithmetic expression. See +print; otherwise the argument is evaluated as an arithmetic expression. See ifzman(the section `Arithmetic Evaluation' in zmanref(zshmisc))\ ifnzman(noderef(Arithmetic Evaluation)) for a description of arithmetic @@ -1283,8 +1289,9 @@ contain symbolic links. alias(r)(fc -e -) findex(read) vindex(IFS, use of) -ifzman(xitem(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ])) -item(ifnzman(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ]) [ tt(-u) var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ ))ifnztexi( ))) +xitem(tt(read )[ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ]) +item(SPACES()[ tt(-u) var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])( vindex(REPLY, use of) vindex(reply, use of) Read one line and break it into fields using the characters @@ -1436,7 +1443,9 @@ cindex(parameters, positional) cindex(parameters, setting array) cindex(array parameters, setting) pindex(KSH_ARRAYS, use of) -item(tt(set) [ {tt(PLUS())|tt(-)}var(options) | {tt(PLUS())|tt(-)}tt(o) [ var(option_name) ] ] ... [ {tt(PLUS())|tt(-)}tt(A) [ var(name) ] ] [ var(arg) ... ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ ))ifnztexi( ))) +xitem(tt(set )[ {tt(PLUS())|tt(-)}var(options) | {tt(PLUS())|tt(-)}tt(o) [ var(option_name) ] ] ... [ {tt(PLUS())|tt(-)}tt(A) [ var(name) ] ]) +item(SPACES()[ var(arg) ... ])( Set the options for the shell and/or set the positional parameters, or declare and set an array. If the tt(-s) option is given, it causes the specified arguments to be sorted before assigning them to the positional @@ -1487,7 +1496,7 @@ module(setcap)(zsh/cap) findex(setopt) cindex(options, setting) item(tt(setopt) [ {tt(PLUS())|tt(-)}var(options) | \ -{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])( +{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ tt(-m) ] [ var(name) ... ])( Set the options for the shell. All options specified either with flags or by name are set. @@ -1653,7 +1662,7 @@ Do nothing and return an exit status of 0. ) findex(ttyctl) cindex(tty, freezing) -item(tt(ttyctl) tt(-fu))( +item(tt(ttyctl) [ tt(-fu) ])( The tt(-f) option freezes the tty (i.e. terminal or terminal emulator), and tt(-u) unfreezes it. When the tty is frozen, no changes made to the tty settings by @@ -1682,12 +1691,13 @@ Equivalent to tt(whence -v). findex(typeset) cindex(parameters, setting) cindex(parameters, declaring) -xitem(tt(typeset) [ {tt(PLUS())|tt(-)}tt(AEFHUafghklprtuxmz) ] [ tt(-LRZi) \ -[ var(n) ]] [ \ -var(name)[tt(=)var(value)] ... ]) -item(tt(typeset) -T [ {tt(PLUS()|tt(-))}tt(Urux) ] \ - [ tt(-LRZ) [ var(n) ]] \ - var(SCALAR)[tt(=)var(value)] var(array) tt([) var(sep) tt(]))( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(typeset )[ {tt(PLUS())|tt(-)}tt(AHUaghlmprtux) ] \ +[ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ]) +xitem(SPACES()[ tt(+) | var(name)[tt(=)var(value)] ... ]) +xitem(tt(typeset )tt(-T) [ {tt(PLUS())|tt(-)}tt(Uglprux) ] [ {tt(PLUS())|tt(-)}tt(LRZ) [ var(n) ] ]) +xitem(SPACES()[ tt(+) | var(SCALAR)[tt(=)var(value)] var(array) [ var(sep) ] ]) +item(tt(typeset) tt(-f) [ {tt(PLUS())|tt(-)}tt(TUkmtuz) ] [ tt(+) | var(name) ... ])( Set or display attributes and values for shell parameters. A parameter is created for each var(name) that does not already refer @@ -1780,6 +1790,11 @@ form of a typeset command and an assignment (which will be printed separately for arrays and associative arrays), regardless of other flags and options. Note that the tt(-H) flag on parameters is respected; no value will be shown for these parameters. + +As the intention of this option is to produce output that can restore +the current state, readonly specials (whose values cannot be +changed) are not shown and assignments to arrays are shown before +the tt(typeset) rendering the array readonly. ) item(tt(-T) [ var(scalar)[tt(=)var(value)] var(array) [ var(sep) ] ])( This flag has a different meaning when used with tt(-f); see below. @@ -1811,7 +1826,7 @@ as before but the separator is changed. enditem() Attribute flags that transform the final value (tt(-L), tt(-R), tt(-Z), -tt(-l), tt(u)) are only applied to the expanded value at the point +tt(-l), tt(-u)) are only applied to the expanded value at the point of a parameter expansion expression using `tt($)'. They are not applied when a parameter is retrieved internally by the shell for any purpose. @@ -1824,8 +1839,9 @@ ifzman(`Array Parameters' in zmanref(zshparam))\ ifnzman(noderef(Array Parameters))\ . ) -item(tt(-L))( -Left justify and remove leading blanks from var(value). +item(tt(-L) [ var(n) ])( +Left justify and remove leading blanks from the value when the parameter +is expanded. If var(n) is nonzero, it defines the width of the field. If var(n) is zero, the width is determined by the width of the value of the first assignment. In the case of numeric parameters, the length of the @@ -1845,7 +1861,7 @@ blanks or truncated if necessary to fit the field. Note truncation can lead to unexpected results with numeric parameters. Leading zeros are removed if the tt(-Z) flag is also set. ) -item(tt(-R))( +item(tt(-R) [ var(n) ])( Similar to tt(-L), except that right justification is used; when the parameter is expanded, the field is left filled with blanks or truncated from the end. May not be combined with the tt(-Z) @@ -1857,7 +1873,7 @@ occurrence of each duplicated value. This may also be set for colon-separated special parameters like tt(PATH) or tt(FIGNORE), etc. This flag has a different meaning when used with tt(-f); see below. ) -item(tt(-Z))( +item(tt(-Z) [ var(n) ])( Specially handled if set along with the tt(-L) flag. Otherwise, similar to tt(-R), except that leading zeros are used for padding instead of blanks if the first non-blank character is a digit. @@ -1884,7 +1900,7 @@ parameter will be searched to find the function definition when the function is first referenced; see noderef(Functions). The tt(-k) and tt(-z) flags make the function be loaded using ksh-style or zsh-style autoloading respectively. If neither is given, the setting of the -KSH_AUTOLOAD option determines how the function is loaded. +tt(KSH_AUTOLOAD) option determines how the function is loaded. ) item(tt(-h))( Hide: only useful for special parameters (those marked `<S>' in the table in @@ -1914,18 +1930,18 @@ default for the parameters in the tt(zsh/parameter) and tt(zsh/mapfile) modules. Note, however, that unlike the tt(-h) flag this is also useful for non-special parameters. ) -item(tt(-i))( +item(tt(-i) [ var(n) ])( Use an internal integer representation. If var(n) is nonzero it defines the output arithmetic base, otherwise it is determined by the first assignment. Bases from 2 to 36 inclusive are allowed. ) -item(tt(-E))( +item(tt(-E) [ var(n) ])( Use an internal double-precision floating point representation. On output the variable will be converted to scientific notation. If var(n) is nonzero it defines the number of significant figures to display; the default is ten. ) -item(tt(-F))( +item(tt(-F) [ var(n) ])( Use an internal double-precision floating point representation. On output the variable will be converted to fixed-point decimal notation. If var(n) is nonzero it defines the number of digits to display after the decimal @@ -1968,7 +1984,7 @@ enditem() findex(ulimit) cindex(resource limits) cindex(limits, resource) -item(tt(ulimit) [ [ tt(-SHacdfiklmnpqsTtvwx) | tt(-N) var(resource) [ var(limit) ] ... ])( +item(tt(ulimit) [ tt(-HSa) ] [ { tt(-bcdfiklmnpqrsTtvwx) | tt(-N) var(resource) } [ var(limit) ] ... ])( Set or display resource limits of the shell and the processes started by the shell. The value of var(limit) can be a number in the unit specified below or one of the values `tt(unlimited)', which removes the limit on the @@ -2040,7 +2056,14 @@ the symbolic form the permissions you specify are those which are to be allowed (not denied) to the users specified. ) cindex(aliases, removing) -alias(unalias)(unhash -a) +item(tt(unalias) [ tt(-ams) ] var(name) ...)( +Removes aliases. This command works the same as tt(unhash -a), except that +the tt(-a) option removes all regular or global aliases, or with tt(-s) +all suffix aliases: in this case no var(name) arguments may appear. The +options tt(-m) (remove by pattern) and tt(-s) without tt(-a) (remove +listed suffix aliases) behave as for tt(unhash -a). Note that +the meaning of tt(-a) is different between tt(unalias) and tt(unhash). +) cindex(functions, removing) alias(unfunction)(unhash -f) findex(unhash) @@ -2132,7 +2155,7 @@ to process IDs. ) findex(whence) item(tt(whence) [ tt(-vcwfpamsS) ] var(name) ...)( -For each name, indicate how it would be interpreted if used as a +For each var(name), indicate how it would be interpreted if used as a command name. tt(whence) is most useful when var(name) is only the last path component @@ -2334,7 +2357,7 @@ findex(zmodload) cindex(modules, loading) cindex(loading modules) xitem(tt(zmodload) [ tt(-dL) ] [ ... ]) -xitem(tt(zmodload -F) [ tt(-lLme) tt(-P) tt(param) ] var(module) [tt(PLUS()-)]var(feature...)) +xitem(tt(zmodload -F) [ tt(-alLme) tt(-P) var(param) ] var(module) [ [tt(PLUS()-)]var(feature) ... ]) xitem(tt(zmodload -e) [ tt(-A) ] [ ... ]) xitem(tt(zmodload) [ tt(-a) [ tt(-bcpf) [ tt(-I) ] ] ] [ tt(-iL) ] ...) xitem(tt(zmodload) tt(-u) [ tt(-abcdpf) [ tt(-I) ] ] [ tt(-iL) ] ...) @@ -2385,7 +2408,7 @@ Each module has a boot and a cleanup function. The module will not be loaded if its boot function fails. Similarly a module can only be unloaded if its cleanup function runs successfully. ) -item(tt(zmodload -F) [ tt(-almLe) tt(-P) tt(param) ] var(module) [tt(PLUS()-)]var(feature...))( +item(tt(zmodload -F) [ tt(-almLe) tt(-P) var(param) ] var(module) [ [tt(PLUS()-)]var(feature) ... ])( tt(zmodload -F) allows more selective control over the features provided by modules. With no options apart from tt(-F), the module named var(module) is loaded, if it was not already loaded, and the list of @@ -2416,7 +2439,7 @@ feature per line. With tt(-L) alone, a tt(zmodload -F) command that would cause enabled features of the module to be turned on is shown. With tt(-lL), a tt(zmodload -F) command that would cause all the features to be set to their current state is shown. If one of these combinations is given -the option tt(-P) var(param) then the parameter tt(param) is set to an +with the option tt(-P) var(param) then the parameter var(param) is set to an array of features, either features together with their state or (if tt(-L) alone is given) enabled features. diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo index 6b5fe27fb..c20c87e61 100644 --- a/Doc/Zsh/calsys.yo +++ b/Doc/Zsh/calsys.yo @@ -272,7 +272,7 @@ When an anchor time is present, there is an extension to handle regular events in the form of the var(n)th var(some)day of the month. Such a specification must occur immediately after any year and month specification, but before any time of day, and must be in the form -var(n)tt(LPAR()th|st|rd+RPAR()) var(day), for example tt(1st Tuesday) or +var(n)(tt(th)|tt(st)|tt(rd)) var(day), for example tt(1st Tuesday) or tt(3rd Monday). As in other places, days are matched case insensitively, must be in English, and only the first three letters are significant except that a form beginning `month' does not match `Monday'. No attempt is made @@ -320,8 +320,11 @@ subsect(Calendar system functions) startitem() findex(calendar) -xitem(tt(calendar) [ tt(-abdDsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ [ var(start) ] var(end) ])( -item(tt(calendar -r) [ tt(-abdDrsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ var(start) ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(calendar )[ tt(-abdDsv) ] [ tt(-C) var(calfile) ] [ tt(-n) var(num) ] [ tt(-S) var(showprog) ]) +xitem(SPACES()[ [ var(start) ] var(end) ]) +xitem(tt(calendar -r) [ tt(-abdDrsv) ] [ tt(-C) var(calfile) ] [ tt(-n) var(num) ] [ tt(-S) var(showprog) ]) +item(SPACES()[ var(start) ])( Show events in the calendar. With no arguments, show events from the start of today until the end of @@ -379,9 +382,9 @@ Show at least var(num) events, if present in the calendar file, regardless of the tt(start) and tt(end). ) item(tt(-r))( -Show all the remaining options in the calendar, ignoring the given tt(end) -time. The tt(start) time is respected; any argument given is treated -as a tt(start) time. +Show all the remaining options in the calendar, ignoring the given var(end) +time. The var(start) time is respected; any argument given is treated +as a var(start) time. ) item(tt(-s))( Use the shell's tt(sched) command to schedule a timed event that @@ -471,7 +474,7 @@ the dates in the calendar file. enditem() ) findex(calendar_add) -item(tt(calendar_add) [ tt(-BL) ] var(event ...))( +item(tt(calendar_add) [ tt(-BL) ] var(event) ...)( Adds a single event to the calendar in the appropriate location. The event can contain multiple lines, as described in ifnzman(noderef(Calendar File and Date Formats))\ @@ -578,7 +581,7 @@ keywords and values.) endsitem() findex(calendar_showdate) -item(tt(calendar_showdate) [ tt(-r) ] [ tt(-f) var(fmt) ] var(date-spec ...))( +item(tt(calendar_showdate) [ tt(-r) ] [ tt(-f) var(fmt) ] var(date-spec) ...)( The given var(date-spec) is interpreted and the corresponding date and time printed. If the initial var(date-spec) begins with a tt(PLUS()) or tt(-) it is treated as relative to the current time; var(date-spec)s after diff --git a/Doc/Zsh/compctl.yo b/Doc/Zsh/compctl.yo index fa13a747e..d06b31d25 100644 --- a/Doc/Zsh/compctl.yo +++ b/Doc/Zsh/compctl.yo @@ -23,11 +23,12 @@ the older tt(compctl) command. sect(Description) findex(compctl) )\ +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) startlist() list(tt(compctl) [ tt(-CDT) ] var(options) [ var(command) ... ]) -list(tt(compctl) [ tt(-CDT) ] var(options) \ - [ tt(-x) var(pattern) var(options) tt(-) ... tt(-)tt(-) ] \ - [ tt(PLUS()) var(options) [ tt(-x) ... tt(-)tt(-) ] ... [tt(PLUS())] ] \ +list(tt(compctl )[ tt(-CDT) ] var(options) \ + [ tt(-x) var(pattern) var(options) tt(-) ... tt(-)tt(-) ]) +list(SPACES()[ tt(PLUS()) var(options) [ tt(-x) ... tt(-)tt(-) ] ... [tt(PLUS())] ] \ [ var(command) ... ]) list(tt(compctl) tt(-M) var(match-specs) ...) list(tt(compctl) tt(-L) [ tt(-CDTM) ] [ var(command) ... ]) @@ -109,7 +110,8 @@ that completion after `tt(~)' is too slow to be usable), you can use example(compctl -T -x 's[~] C[0,[^/]#]' -k friends -S/ -tn) to complete the strings in the array tt(friends) after a `tt(~)'. -The tt(C[...]) argument is necessary so that this form of ~-completion is +The tt(C[)var(...)tt(]) argument is necessary so that this form of +tt(~)-completion is not tried after the directory name is finished. ) item(tt(-L))( @@ -470,7 +472,7 @@ string. The sequences tt(%B), tt(%b), tt(%S), tt(%s), tt(%U), and tt(%u) specify output attributes (bold, standout, and underline), tt(%F), tt(%f), tt(%K), -tt(%k) specify foreground and background colours, and tt(%{...%}) can +tt(%k) specify foreground and background colours, and tt(%{)var(...)tt(%}) can be used to include literal escape sequences as in prompts. ) item(tt(-Y) var(explanation))( @@ -504,7 +506,7 @@ This gives the name of the group the matches should be placed in. Groups are listed and sorted separately; likewise, menu completion will offer the matches in the groups in the order in which the groups were defined. If no group name is explicitly given, the matches are stored in -a group named var(default). The first time a group name is encountered, +a group named tt(default). The first time a group name is encountered, a group with that name is created. After that all matches with the same group name are stored in that group. @@ -565,13 +567,14 @@ Additional options are available that restrict completion to some part of the command line; this is referred to as `extended completion'. sect(Extended Completion) +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) startlist() -list(tt(compctl) [ tt(-CDT) ] var(options) \ +list(tt(compctl )[ tt(-CDT) ] var(options) \ tt(-x) var(pattern) var(options) tt(-) ... tt(-)tt(-)) -list( [ var(command) ... ]) -list(tt(compctl) [ tt(-CDT) ] var(options) \ +list(SPACES()[ var(command) ... ]) +list(tt(compctl )[ tt(-CDT) ] var(options) \ [ tt(-x) var(pattern) var(options) tt(-) ... tt(-)tt(-) ]) -list( [ tt(PLUS()) var(options) [ tt(-x) ... tt(-)tt(-) ] ... \ +list(SPACES()[ tt(PLUS()) var(options) [ tt(-x) ... tt(-)tt(-) ] ... \ [tt(PLUS())] ] [ var(command) ... ]) endlist() @@ -677,7 +680,7 @@ enditem() texinode(Example)()(Extended Completion)(Completion Using compctl) sect(Example) -example(compctl -u -x 's[tt(PLUS())] c[-1,-f],s[-f+PLUS()]' \ +example(compctl -u -x 's[PLUS()] c[-1,-f],s[-f+PLUS()]' \ -g '~/Mail/*(:t)' - 's[-f],c[-1,-f]' -f -- mail) This is to be interpreted as follows: diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index b699502ca..a081ea32c 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -224,7 +224,7 @@ will try to find more by adding the directory tt(_compdir) to the search path. If that directory has a subdirectory named tt(Base), all subdirectories will be added to the path. Furthermore, if the subdirectory tt(Base) has a subdirectory named tt(Core), tt(compinit) will add all -subdirectories of the subdirectories is to the path: this allows +subdirectories of the subdirectories to the path: this allows the functions to be in the same format as in the tt(zsh) source distribution. @@ -238,9 +238,9 @@ completion system and will not be treated specially. The tags are: startitem() -item(tt(#compdef) var(names...) [ tt(-[pP]) var(patterns...) [ tt(-N) var(names...) ] ])( +item(tt(#compdef) var(name) ... [ tt(-){tt(p)|tt(P)} var(pattern) ... [ tt(-N) var(name) ... ] ])( The file will be made autoloadable and the function defined -in it will be called when completing var(names), each of which is +in it will be called when completing var(name)s, each of which is either the name of a command whose arguments are to be completed or one of a number of special contexts in the form tt(-)var(context)tt(-) described below. @@ -265,9 +265,9 @@ The option tt(-N) is used after a list following tt(-p) or tt(-P); it specifies that remaining words no longer define patterns. It is possible to toggle between the three options as many times as necessary. ) -item(tt(#compdef -k) var(style key-sequences...))( +item(tt(#compdef -k) var(style key-sequence) ...)( This option creates a widget behaving like the -builtin widget var(style) and binds it to the given var(key-sequences), +builtin widget var(style) and binds it to the given var(key-sequence)s, if any. The var(style) must be one of the builtin widgets that perform completion, namely tt(complete-word), tt(delete-char-or-list), tt(expand-or-complete), tt(expand-or-complete-prefix), tt(list-choices), @@ -277,14 +277,14 @@ ifzman(zmanref(zshmodules))\ ifnzman(noderef(The zsh/complist Module))\ ) the widget tt(menu-select) is also available. -When one of the var(key-sequences) is typed, the function in the file will +When one of the var(key-sequence)s is typed, the function in the file will be invoked to generate the matches. Note that a key will not be re-bound if it already was (that is, was bound to something other than tt(undefined-key)). The widget created has the same name as the file and can be bound to any other keys using tt(bindkey) as usual. ) -item(tt(#compdef -K) var(widget-name) var(style) var(key-sequences) ...)( -This is similar to tt(-k) except that only one var(key-sequences) +item(tt(#compdef -K) var(widget-name) var(style) var(key-sequence) [ var(name) var(style) var(seq) ... ])( +This is similar to tt(-k) except that only one var(key-sequence) argument may be given for each var(widget-name) var(style) pair. However, the entire set of three arguments may be repeated with a different set of arguments. Note in particular that the @@ -319,11 +319,11 @@ startitem() kindex(-array-value-, completion context) item(tt(-array-value-))( The right hand side of an array-assignment -(`tt(foo=LPAR()...RPAR())') +(`var(name)tt(=LPAR())var(...)tt(RPAR())') ) kindex(-brace-parameter-, completion context) item(tt(-brace-parameter-))( -The name of a parameter expansion within braces (`tt(${...})') +The name of a parameter expansion within braces (`tt(${)var(...)tt(})') ) kindex(-assign-parameter-, completion context) item(tt(-assign-parameter-))( @@ -336,7 +336,7 @@ A word in command position ) kindex(-condition-, completion context) item(tt(-condition-))( -A word inside a condition (`tt([[...]])') +A word inside a condition (`tt([[)var(...)tt(]])') ) kindex(-default-, completion context) item(tt(-default-))( @@ -359,11 +359,11 @@ functions defined for commands will be. kindex(-math-, completion context) item(tt(-math-))( Inside mathematical contexts, such as -`tt(LPAR()LPAR())...tt(RPAR()RPAR())' +`tt(LPAR()LPAR())var(...)tt(RPAR()RPAR())' ) kindex(-parameter-, completion context) item(tt(-parameter-))( -The name of a parameter expansion (`tt($...)') +The name of a parameter expansion (`tt($)var(...)') ) kindex(-redirect-, completion context) item(tt(-redirect-))( @@ -402,7 +402,8 @@ field will be empty. For the tt(-value-) context, the form is `tt(-value-,)var(name)tt(,)var(command)', where var(name) is the name of -the parameter. In the case of elements of an associative array, for +the parameter on the left hand side of the assignment. +In the case of elements of an associative array, for example `tt(assoc=LPAR()key <TAB>)', var(name) is expanded to `var(name)tt(-)var(key)'. In certain special contexts, such as completing after `tt(make CFLAGS=)', the var(command) part gives the @@ -447,10 +448,11 @@ directly. findex(compdef) cindex(completion system, adding definitions) startitem() -xitem(tt(compdef) [ tt(-ane) ] var(function names...) [ tt(-[pP]) var(patterns...) [ tt(-N) var(names...) ] ]) -xitem(tt(compdef -d) var(names...)) -xitem(tt(compdef -k) [ tt(-an) ] var(function style key-sequences...)) -item(tt(compdef -K) [ tt(-an) ] var(function name style key-sequences ...))( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(compdef) [ tt(-ane) ] var(function name) ... [ tt(-){tt(p)|tt(P)} var(pattern) ... [ tt(-N) var(name) ...]]) +xitem(tt(compdef -d) var(name) ...) +xitem(tt(compdef -k) [ tt(-an) ] var(function style key-sequence) [ var(key-sequence) ... ]) +item(tt(compdef -K) [ tt(-an) ] var(function name style key-seq) [ var(name style seq) ... ])( The first form defines the var(function) to call for completion in the given contexts as described for the tt(#compdef) tag above. @@ -477,7 +479,7 @@ command or context from being overwritten. The option tt(-d) deletes any completion defined for the command or contexts listed. -The var(names) may also contain tt(-p), tt(-P) and tt(-N) options as +The var(name)s may also contain tt(-p), tt(-P) and tt(-N) options as described for the tt(#compdef) tag. The effect on the argument list is identical, switching between definitions of patterns tried initially, patterns tried finally, and normal commands and contexts. @@ -489,7 +491,7 @@ set to a value containing the substring `tt(all)', no other function will be called. The form with tt(-k) defines a widget with the same name as the var(function) -that will be called for each of the var(key-sequences); this is like the +that will be called for each of the var(key-sequence)s; this is like the tt(#compdef -k) tag. The function should generate the completions needed and will otherwise behave like the builtin widget whose name is given as the var(style) argument. The widgets usable for this are: @@ -502,7 +504,7 @@ than tt(undefined-key). The form with tt(-K) is similar and defines multiple widgets based on the same var(function), each of which requires the set of three arguments -var(name), var(style) and var(key-sequences), where the latter two are as +var(name), var(style) and var(key-seq)uence, where the latter two are as for tt(-k) and the first must be a unique widget name beginning with an underscore. @@ -568,7 +570,7 @@ The context string always consists of a fixed set of fields, separated by colons and with a leading colon before the first. Fields which are not yet known are left empty, but the surrounding colons appear anyway. The fields are always in the order -tt(:completion:)var(function)tt(:)var(completer)tt(:)var(command)tt(:)var(argument)tt(:)tt(tag). These have the following meaning: +tt(:completion:)var(function)tt(:)var(completer)tt(:)var(command)tt(:)var(argument)tt(:)var(tag). These have the following meaning: startitemize() itemiz(\ @@ -1100,7 +1102,7 @@ values. Any of the strings `tt(true)', `tt(on)', any of the strings `tt(false)', `tt(off)', `tt(no)', and `tt(0)' for the value `false'. The behavior for any other value is undefined except where explicitly mentioned. The default value may -be either true or false if the style is not set. +be either `true' or `false' if the style is not set. Some of these styles are tested first for every possible tag corresponding to a type of match, and if no style was found, for the @@ -1134,7 +1136,7 @@ expanded. For example, if there are parameters tt(foo) and tt(foobar), the string `tt($foo)' will only be expanded if tt(accept-exact) is set to `true'; otherwise the completion system will be allowed to complete tt($foo) to tt($foobar). If the style is set to -`continue', _expand will add the expansion as a match and the completion +`tt(continue)', tt(_expand) will add the expansion as a match and the completion system will also be allowed to continue. ) kindex(accept-exact-dirs, completion style) @@ -1146,24 +1148,24 @@ the component matches an existing directory. For example, when completion after tt(/usr/bin/), the function examines possible completions to tt(/usr). -When this style is true, any prefix of a path that matches an existing +When this style is `true', any prefix of a path that matches an existing directory is accepted without any attempt to complete it further. Hence, in the given example, the path tt(/usr/bin/) is accepted immediately and completion tried in that directory. If you wish to inhibit this behaviour entirely, set the tt(path-completion) -style (see below) to tt(false). +style (see below) to `false'. ) kindex(add-space, completion style) item(tt(add-space))( -This style is used by the tt(_expand) completer. If it is true (the +This style is used by the tt(_expand) completer. If it is `true' (the default), a space will be inserted after all words resulting from the expansion, or a slash in the case of directory names. If the value is `tt(file)', the completer will only add a space -to names of existing files. Either a boolean true or the value +to names of existing files. Either a boolean `true' or the value `tt(file)' may be combined with `tt(subst)', in which case the completer will not add a space to words generated from the expansion of a -substitution of the form `tt($LPAR()...RPAR())' or `tt(${...})'. +substitution of the form `tt($LPAR())var(...)tt(RPAR())' or `tt(${)var(...)tt(})'. The tt(_prefix) completer uses this style as a simple boolean value to decide if a space should be inserted before the suffix. @@ -1282,8 +1284,8 @@ item(tt(complete-options))( This is used by the completer for tt(cd), tt(chdir) and tt(pushd). For these commands a tt(-) is used to introduce a directory stack entry and completion of these is far more common than completing options. -Hence unless the value of this style is true options will not be -completed, even after an initial tt(-). If it is true, options will +Hence unless the value of this style is `true' options will not be +completed, even after an initial tt(-). If it is `true', options will be completed after an initial tt(-) unless there is a preceding tt(-)tt(-) on the command line. ) @@ -1341,7 +1343,7 @@ kindex(disabled, completion style) item(tt(disabled))( If this is set to `true', the tt(_expand_alias) completer and bindable command will try to expand disabled aliases, too. The default is -`tt(false)'. +`false'. ) kindex(domains, completion style) item(tt(domains))( @@ -1451,7 +1453,7 @@ this the following code can be included in an initialization file: example(zmodload -i zsh/stat disable stat) -The style may either be set to a true value (or `tt(all)'), or +The style may either be set to a `true' value (or `tt(all)'), or one of the values `tt(insert)' or `tt(list)', indicating that files are to be listed in long format in all circumstances, or when attempting to insert a file name, or when listing file names @@ -1469,7 +1471,8 @@ or inserting a file with up to 10 matches (assuming a listing is to be shown at all, for example on an ambiguous completion), else short format will be used. -example(zstyle -e ':completion:*' file-list '(( ${+NUMERIC} )) && reply=(true)') +example(zstyle -e ':completion:*' file-list \ + '(( ${+NUMERIC} )) && reply=(true)') specifies that long format will be used any time a numeric argument is supplied, else short format. @@ -1580,14 +1583,14 @@ If this is set for the tt(descriptions) tag, its value is used as a string to display above matches in completion lists. The sequence `tt(%d)' in this string will be replaced with a short description of what these matches are. This string may also contain the following -sequences to specify output attributes, -ifnzman(noderef(Prompt Expansion))\ +sequences to specify output attributes +ifnzman((see noderef(Prompt Expansion)))\ ifzman(as described in the section EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc)): `tt(%B)', `tt(%S)', `tt(%U)', `tt(%F)', `tt(%K)' and their lower case counterparts, as well as `tt(%{)...tt(%})'. `tt(%F)', `tt(%K)' and `tt(%{)...tt(%})' take arguments in the same form as prompt -expansion. Note that the tt(%G) sequence is not available; an argument +expansion. Note that the sequence `tt(%G)' is not available; an argument to `tt(%{)' should be used instead. The style is tested with each tag valid for the current completion @@ -1637,8 +1640,10 @@ aliases, shell functions and parameters and reserved words as possible completions. To have the external commands and shell functions listed separately: -example(zstyle ':completion:*:*:-command-:*:commands' group-name commands -zstyle ':completion:*:*:-command-:*:functions' group-name functions) +example(zstyle ':completion:*:*:-command-:*:commands' \ + group-name commands +zstyle ':completion:*:*:-command-:*:functions' \ + group-name functions) As a consequence, any match with the same tag will be displayed in the same group. @@ -1674,7 +1679,7 @@ group names are taken from the YP database or the file `tt(/etc/group)'. ) kindex(hidden, completion style) item(tt(hidden))( -If this is set to true, matches for the given context +If this is set to `true', matches for the given context will not be listed, although any description for the matches set with the tt(format) style will be shown. If it is set to `tt(all)', not even the description will be @@ -1700,7 +1705,7 @@ of hostnames; multiple ports for the same host may appear. kindex(ignore-line, completion style) item(tt(ignore-line))( This is tested for each tag valid for the current completion. If -it is set to `tt(true)', none of the words that are already on the line +it is set to `true', none of the words that are already on the line will be considered as possible completions. If it is set to `tt(current)', the word the cursor is on will not be considered as a possible completion. The value `tt(current-shown)' is similar but only @@ -1847,14 +1852,14 @@ there were other changes between the expanded words and the original word from the command line. Any other value forces the prefix to be expanded unconditionally. -The behaviour of expand when this style is true is to cause tt(_expand) +The behaviour of tt(_expand) when this style is `true' is to cause tt(_expand) to give up when a single expansion with the restored prefix is the same as the original; hence any remaining completers may be called. ) kindex(last-prompt, completion style) item(tt(last-prompt))( This is a more flexible form of the tt(ALWAYS_LAST_PROMPT) option. -If it is true, the completion system will try to return the cursor to +If it is `true', the completion system will try to return the cursor to the previous command line after displaying a completion list. It is tested for all tags valid for the current completion, then the tt(default) tag. The cursor will be moved back to the @@ -1900,7 +1905,8 @@ tt(ZLS_COLOURS) parameters and simply using the tt(default) tag. It is possible to use any color specifications already set up for the GNU version of the tt(ls) command: -example(zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}) +example(zstyle ':completion:*:default' list-colors \ + ${(s.:.)LS_COLORS}) The default colors are the same as for the GNU tt(ls) command and can be obtained by setting the style to an empty string (i.e. tt('')). @@ -1969,7 +1975,7 @@ if the tt(LIST_ROWS_FIRST) option were set. kindex(list-suffixes, completion style) item(tt(list-suffixes))( This style is used by the function that completes filenames. If it is -true, and completion is attempted on a string containing multiple partially +`true', and completion is attempted on a string containing multiple partially typed pathname components, all ambiguous components will be shown. Otherwise, completion stops at the first ambiguous component. ) @@ -2040,7 +2046,8 @@ specification is prefixed with tt(+), it is added to the existing list. Hence it is possible to create increasingly general specifications without repetition: -example(zstyle ':completion:*' matcher-list '' '+m:{a-z}={A-Z}' '+m:{A-Z}={a-z}') +example(zstyle ':completion:*' matcher-list \ + '' '+m:{a-z}={A-Z}' '+m:{A-Z}={a-z}') It is possible to create match specifications valid for particular completers by using the third field of the context. This applies only @@ -2060,7 +2067,8 @@ normal completion without a match specification, then normal completion with case-insensitive matching, then correction, and finally partial-word completion: -example(zstyle ':completion:*' completer _complete _correct _complete:foo +example(zstyle ':completion:*' completer \ + _complete _correct _complete:foo zstyle ':completion:*:complete:*:*:*' matcher-list \ '' 'm:{a-zA-Z}={A-Za-z}' zstyle ':completion:*:foo:*:*:*' matcher-list \ @@ -2128,20 +2136,20 @@ more of the description to be visible. ) kindex(menu, completion style) item(tt(menu))( -If this is true in the context of any of the tags defined +If this is `true' in the context of any of the tags defined for the current completion menu completion will be used. The value for a specific tag will take precedence over that for the `tt(default)' tag. -If none of the values found in this way is true but at least +If none of the values found in this way is `true' but at least one is set to `tt(auto)', the shell behaves as if the tt(AUTO_MENU) option is set. -If one of the values is explicitly set to false, menu +If one of the values is explicitly set to `false', menu completion will be explicitly turned off, overriding the tt(MENU_COMPLETE) option and other settings. In the form `tt(yes=)var(num)', where `tt(yes)' may be any of the -true values (`tt(yes)', `tt(true)', `tt(on)' and `tt(1)'), +`true' values (`tt(yes)', `tt(true)', `tt(on)' and `tt(1)'), menu completion will be turned on if there are at least var(num) matches. In the form `tt(yes=long)', menu completion will be turned on if the list does not fit on the screen. This does not activate menu @@ -2256,7 +2264,7 @@ the tt(_oldlist) completer. For example, suppose you type tt(^Xc) to generate a list of corrections, and menu completion is started in one of the usual ways. Usually, or with -this style set to tt(false), typing tt(TAB) at this point would start +this style set to `false', typing tt(TAB) at this point would start trying to complete the line as it now appears. With tt(_oldlist), it instead continues to cycle through the list of corrections. ) @@ -2296,11 +2304,11 @@ item(tt(path-completion))( This is used by filename completion. By default, filename completion examines all components of a path to see if there are completions of that component. For example, tt(/u/b/z) can be completed to -tt(/usr/bin/zsh). Explicitly setting this style to tt(false) inhibits this +tt(/usr/bin/zsh). Explicitly setting this style to `false' inhibits this behaviour for path components up to the tt(/) before the cursor; this overrides the setting of tt(accept-exact-dirs). -Even with the style set to tt(false), it is still possible to complete +Even with the style set to `false', it is still possible to complete multiple paths by setting the option tt(COMPLETE_IN_WORD) and moving the cursor back to the first component in the path to be completed. For example, tt(/u/b/z) can be completed to tt(/usr/bin/zsh) if the cursor is @@ -2373,7 +2381,7 @@ will be completed. If it is a range of the form `var(max)tt(:)var(slice)', the last var(slice) words will be completed; then if that yields no matches, the var(slice) words before those will be tried and -so on. This process stops either when at least one match was been +so on. This process stops either when at least one match has been found, or var(max) words have been tried. The default is to complete all words from the history at once. @@ -2403,8 +2411,8 @@ tt(zle_tr)em(TAB) can be completed to tt(Zle/zle_tricky.c). kindex(regular, completion style) item(tt(regular))( This style is used by the tt(_expand_alias) completer and bindable -command. If set to `tt(true)' (the default), regular aliases will be -expanded but only in command position. If it is set to `tt(false)', +command. If set to `true' (the default), regular aliases will be +expanded but only in command position. If it is set to `false', regular aliases will never be expanded. If it is set to `tt(always)', regular aliases will be expanded even if not in command position. ) @@ -2418,7 +2426,7 @@ slow file access. ) kindex(remote-access, completion style) item(tt(remote-access))( -If set to tt(false), certain commands will be prevented from making +If set to `false', certain commands will be prevented from making Internet connections to retrieve remote information. This includes the completion for the tt(CVS) command. @@ -2468,13 +2476,13 @@ item(tt(show-ambiguity))( If the tt(zsh/complist) module is loaded, this style can be used to highlight the first ambiguous character in completion lists. The value is either a color indication such as those supported by the -tt(list-colors) style or, with a value of tt(true), a default of +tt(list-colors) style or, with a value of `true', a default of underlining is selected. The highlighting is only applied if the completion display strings correspond to the actual matches. ) kindex(show-completer, completion style) item(tt(show-completer))( -Tested whenever a new completer is tried. If it is true, the completion +Tested whenever a new completer is tried. If it is `true', the completion system outputs a progress message in the listing area showing what completer is being tried. The message will be overwritten by any output when completions are found and is removed after completion is finished. @@ -2492,7 +2500,7 @@ item(tt(sort))( Many completion widgets call tt(_description) at some point which decides whether the matches are added sorted or unsorted (often indirectly via tt(_wanted) or tt(_requested)). This style can be set -explicitly to one of the usual true or false values as an override. +explicitly to one of the usual `true' or `false' values as an override. If it is not set for the context, the standard behaviour of the calling widget is used. @@ -2502,7 +2510,7 @@ if that fails to produce a value against the context without the tag. If the calling widget explicitly requests unsorted matches, this is usually honoured. However, the default (unsorted) behaviour of completion for the command history may be overridden by setting the style to -tt(true). +`true'. In the tt(_expand) completer, if it is set to `true', the expansions generated will always be sorted. If it is set @@ -2561,7 +2569,7 @@ kindex(substitute, completion style) item(tt(substitute))( This boolean style controls whether the tt(_expand) completer will first try to expand all substitutions in the string (such as -`tt($LPAR()...RPAR())' and `tt(${...})'). +`tt($LPAR())var(...)tt(RPAR())' and `tt(${)var(...)tt(})'). The default is `true'. ) @@ -2647,7 +2655,8 @@ underscore the first time completion is tried: example(zstyle ':completion:*:*:-command-:*:*' tag-order \ 'functions:-non-comp *' functions -zstyle ':completion:*:functions-non-comp' ignored-patterns '_*') +zstyle ':completion:*:functions-non-comp' \ + ignored-patterns '_*') On the first attempt, all tags will be offered but the tt(functions) tag will be replaced by tt(functions-non-comp). The tt(ignored-patterns) style @@ -2662,10 +2671,12 @@ example(zstyle ':completion:*' tag-order \ 'options:-long:long\ options options:-short:short\ options options:-single-letter:single\ letter\ options' - -zstyle ':completion:*:options-long' ignored-patterns '[-+](|-|[^-]*)' -zstyle ':completion:*:options-short' ignored-patterns '--*' '[-+]?' -zstyle ':completion:*:options-single-letter' ignored-patterns '???*') +zstyle ':completion:*:options-long' \ + ignored-patterns '[-+](|-|[^-]*)' +zstyle ':completion:*:options-short' \ + ignored-patterns '--*' '[-+]?' +zstyle ':completion:*:options-single-letter' \ + ignored-patterns '???*') With the tt(group-names) style set, options beginning with `tt(-)tt(-)', options beginning with a single `tt(-)' or `tt(+)' but @@ -2787,7 +2798,7 @@ kindex(use-ip, completion style) item(tt(use-ip))( By default, the function tt(_hosts) that completes host names strips IP addresses from entries read from host databases such as NIS and -ssh files. If this style is true, the corresponding IP addresses +ssh files. If this style is `true', the corresponding IP addresses can be completed as well. This style is not use in any context where the tt(hosts) style is set; note also it must be set before the cache of host names is generated (typically the first completion @@ -2834,7 +2845,7 @@ This is used by the tt(_list) completer, which prevents the insertion of completions until a second completion attempt when the line has not changed. The normal way of finding out if the line has changed is to compare its entire contents between the two occasions. If this style is -true, the comparison is instead performed only on the current word. +`true', the comparison is instead performed only on the current word. Hence if completion is performed on another word with the same contents, completion will not be delayed. ) @@ -2898,7 +2909,8 @@ then use tt(^Xa) to show all matches. It is possible instead to add a standard completer to the list and request that the list of all matches should be directly inserted: -example(zstyle ':completion:all-matches::::' completer _all_matches _complete +example(zstyle ':completion:all-matches::::' completer \ + _all_matches _complete zstyle ':completion:all-matches:*' insert true) In this case the tt(old-matches) style should not be set. @@ -3009,7 +3021,8 @@ completer field in the context name is tt(correct). For example, with: -example(zstyle ':completion:::::' completer _complete _correct _approximate +example(zstyle ':completion:::::' completer \ + _complete _correct _approximate zstyle ':completion:*:correct:::' max-errors 2 not-numeric zstyle ':completion:*:approximate:::' max-errors 3 numeric) @@ -3261,21 +3274,21 @@ This includes the bindings for `tt(~)' in case they were already bound to something else; the completion code does not override user bindings. ) findex(_correct_filename (^XC)) -item(tt(_correct_filename (^XC)))( +item(tt(_correct_filename) (tt(^XC)))( Correct the filename path at the cursor position. Allows up to six errors in the name. Can also be called with an argument to correct a filename path, independently of zle; the correction is printed on standard output. ) findex(_correct_word) (^Xc) -item(tt(_correct_word) (^Xc))( +item(tt(_correct_word) (tt(^Xc)))( Performs correction of the current argument using the usual contextual completions as possible choices. This stores the string `tt(correct-word)' in the var(function) field of the context name and then calls the tt(_correct) completer. ) findex(_expand_alias (^Xa)) -item(tt(_expand_alias (^Xa)))( +item(tt(_expand_alias) (tt(^Xa)))( This function can be used as a completer and as a bindable command. It expands the word the cursor is on if it is an alias. The types of alias expanded can be controlled with the styles tt(regular), tt(global) @@ -3289,7 +3302,7 @@ leaves the cursor directly after the completed word so that invoking tt(_expand_alias) once more will expand the now-complete alias name. ) findex(_expand_word (^Xe)) -item(tt(_expand_word (^Xe)))( +item(tt(_expand_word) (tt(^Xe)))( Performs expansion on the current word: equivalent to the standard tt(expand-word) command, but using the tt(_expand) completer. Before calling it, the var(function) field of the context is set to @@ -3316,19 +3329,19 @@ tt(_main_complete) as the list of completers in place of those defined by the tt(completer) style. ) findex(_history_complete_word (\e/)) -item(tt(_history_complete_word) (\e/))( +item(tt(_history_complete_word) (tt(\e/)))( Complete words from the shell's command history. This uses the tt(list), tt(remove-all-dups), tt(sort), and tt(stop) styles. ) findex(_most_recent_file (^Xm)) -item(tt(_most_recent_file (^Xm)))( +item(tt(_most_recent_file) (tt(^Xm)))( Complete the name of the most recently modified file matching the pattern on the command line (which may be blank). If given a numeric argument var(N), complete the var(N)th most recently modified file. Note the completion, if any, is always unique. ) findex(_next_tags (^Xn)) -item(tt(_next_tags) (^Xn))( +item(tt(_next_tags) (tt(^Xn)))( This command alters the set of matches used to that for the next tag, or set of tags, either as given by the tt(tag-order) style or as set by default; these matches would otherwise not be available. @@ -3336,7 +3349,7 @@ Successive invocations of the command cycle through all possible sets of tags. ) findex(_read_comp (^X^R)) -item(tt(_read_comp (^X^R)))( +item(tt(_read_comp) (tt(^X^R)))( Prompt the user for a string, and use that to perform completion on the current word. There are two possibilities for the string. First, it can be a set of words beginning `tt(_)', for example `tt(_files -/)', in which @@ -3360,14 +3373,14 @@ existing string instead of reading a new one. To force a new string to be read, call tt(_read_comp) with a numeric argument. ) findex(_complete_debug (^X?)) -item(tt(_complete_debug (^X?)))( +item(tt(_complete_debug) (tt(^X?)))( This widget performs ordinary completion, but captures in a temporary file a trace of the shell commands executed by the completion system. Each completion attempt gets its own file. A command to view each of these files is pushed onto the editor buffer stack. ) findex(_complete_help (^Xh)) -item(tt(_complete_help (^Xh)))( +item(tt(_complete_help) (tt(^Xh)))( This widget displays information about the context names, the tags, and the completion functions used when completing at the current cursor position. If given a numeric @@ -3415,7 +3428,7 @@ typing `tt(C-x :)' followed by the key sequence for a generic widget will cause trace output for that widget to be saved to a file. ) findex(_complete_tag (^Xt)) -item(tt(_complete_tag (^Xt)))( +item(tt(_complete_tag) (tt(^Xt)))( This widget completes symbol tags created by the tt(etags) or tt(ctags) programmes (note there is no connection with the completion system's tags) stored in a file tt(TAGS), in the format used by tt(etags), or tt(tags), in the @@ -3449,13 +3462,13 @@ it explicitly reinserts itself into the array. startitem() findex(_all_labels) -item(tt(_all_labels) [ tt(-x) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) [ var(command) var(args) ... ])( +item(tt(_all_labels) [ tt(-x) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) [ var(command) var(arg) ... ])( This is a convenient interface to the tt(_next_label) function below, implementing the loop shown in the tt(_next_label) example. The var(command) and its arguments are called to generate the matches. The options stored in the parameter var(name) will automatically be inserted -into the var(args) passed to the var(command). Normally, they are put -directly after the var(command), but if one of the var(args) is a single +into the var(arg)s passed to the var(command). Normally, they are put +directly after the var(command), but if one of the var(arg)s is a single hyphen, they are inserted directly before that. If the hyphen is the last argument, it will be removed from the argument list before the var(command) is called. This allows tt(_all_labels) to be used in almost all @@ -3511,8 +3524,10 @@ Like tt(_tags) this function supports the tt(-C) option to give a different name for the argument context field. ) findex(_arguments) -xitem(tt(_arguments) [ tt(-nswWCRS) ] [ tt(-A) var(pat) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ] [ tt(:) ] var(spec)...) -item(tt(_arguments) [ var(opts)... ] tt(-)tt(-) [ -i var(pats) ] [ tt(-s) var(pair) ] [ var(helpspec)... ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(_arguments )[ tt(-nswWCRS) ] [ tt(-A) var(pat) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ]) +xitem(SPACES()[ tt(:) ] var(spec) ...) +item(tt(_arguments) [ var(opt) ... ] tt(-)tt(-) [ tt(-i) var(pats) ] [ tt(-s) var(pair) ] [ var(helpspec) ... ])( This function can be used to give a complete specification for completion for a command whose arguments follow standard UNIX option and argument conventions. Options to tt(_arguments) itself must be in separate words, @@ -3545,7 +3560,7 @@ completion option names and values. The default var(matchspec) is: example(tt(r:|[_-]=* r:|=*)) This allows partial word completion after `tt(_)' and `tt(-)', for example -`-f-b' can be completed to `tt(-foo-bar)'. +`tt(-f-b)' can be completed to `tt(-foo-bar)'. Each of the following forms is a var(spec) describing individual sets of options or arguments on the command line being analyzed. @@ -3581,7 +3596,7 @@ three colons before the var(message) they are modified to refer only to the normal arguments covered by this description. ) xitem(var(optspec)) -item(var(optspec):var(...))( +item(var(optspec)tt(:)var(...))( This describes an option. The colon indicates handling for one or more arguments to the option; if it is not present, the option is assumed to take no arguments. @@ -3664,7 +3679,7 @@ that follows the var(optspec); see below. ) enditem() -It is possible for options with a literal `PLUS()' or `tt(=)' to +It is possible for options with a literal `tt(PLUS())' or `tt(=)' to appear, but that character must be quoted, for example `tt(-\+)'. The options tt(-S) and tt(-A) are available to simplify the specifications @@ -3727,7 +3742,7 @@ Each of the forms above may be preceded by a list in parentheses of option names and argument numbers. If the given option is on the command line, the options and arguments indicated in parentheses will not be offered. For example, -`tt((-two -three 1)-one:...)' completes the option `tt(-one)'; if this +`tt((-two -three 1)-one:)var(...)' completes the option `tt(-one)'; if this appears on the command line, the options tt(-two) and tt(-three) and the first ordinary argument will not be completed after it. `tt((-foo):)var(...)' specifies an ordinary argument completion; @@ -3736,7 +3751,7 @@ tt(-foo) will not be completed if that argument is already present. Other items may appear in the list of excluded options to indicate various other items that should not be applied when the current specification is matched: a single star (tt(*)) for the rest arguments -(i.e. a specification of the form `tt(*:...)'); a colon (tt(:)) +(i.e. a specification of the form `tt(*:)var(...)'); a colon (tt(:)) for all normal (non-option-) arguments; and a hyphen (tt(-)) for all options. For example, if `tt((*))' appears before an option and the option appears on the command line, the list of remaining arguments @@ -3765,7 +3780,8 @@ tt(compadd) builtin to all var(action)s. The forms for var(action) are as follows. startitem() -item(tt( ) (single unquoted space))( +def(SP)(0)(ifztexi(NOTRANS(@ ))ifnztexi( ))\ +item(tt(SP())(single unquoted space))( This is useful where an argument is required but it is not possible or desirable to generate matches for it. The var(message) will be displayed but no completions listed. Note @@ -3848,7 +3864,7 @@ causes tt(_arguments) on a restricted range; it is necessary to use this trick to insert an appropriate command name into the range for the second call to tt(_arguments) to be able to parse the line. ) -xitem( var(word...)) +xitem(var(tt(SP())word...)) item(var(word...))( This covers all forms other than those above. If the var(action) starts with a space, the remaining list of words will be invoked unchanged. @@ -3957,7 +3973,7 @@ the behaviour of the command is unspecified. In addition to options, `tt(_arguments -)tt(-)' will try to deduce the types of arguments available for options when the form -`tt(-)tt(-)var(opt)=var(val)' is valid. It is also possible to provide +`tt(-)tt(-)var(opt)tt(=)var(val)' is valid. It is also possible to provide hints by examining the help text of the command and adding var(helpspec) of the form `var(pattern)tt(:)var(message)tt(:)var(action)'; note that other tt(_arguments) var(spec) forms are not used. The var(pattern) is matched @@ -4002,7 +4018,7 @@ completed. The patterns can be given as the name of an array parameter or as a literal list in parentheses. For example, example(_arguments -- -i \ - "LPAR()-tt(-(en|dis)able-FEATURE*RPAR()")) + "LPAR()--(en|dis)able-FEATURE*RPAR()") will cause completion to ignore the options `tt(-)tt(-enable-FEATURE)' and `tt(-)tt(-disable-FEATURE)' (this example is @@ -4018,7 +4034,7 @@ For example, some tt(configure)-script help output describes options only as `tt(-)tt(-enable-foo)', but the script also accepts the negated form `tt(-)tt(-disable-foo)'. To allow completion of the second form: -example(tt(_arguments -- -s "LPAR()#-)tt(-enable- -)tt(-disable-RPAR()")) +example(_arguments -- -s "LPAR()(#s)--enable- --disable-RPAR()") Finally, note that tt(_arguments) generally expects to be the primary function handling any completion for which it is used. It may have side @@ -4075,9 +4091,9 @@ example(_example_caching_policy () { }) ) findex(_call_function) -item(tt(_call_function) var(return) var(name) [ var(args) ... ])( +item(tt(_call_function) var(return) var(name) [ var(arg) ... ])( If a function var(name) exists, it is called with the arguments -var(args). The var(return) argument gives the name of a parameter in which +var(arg)s. The var(return) argument gives the name of a parameter in which the return status from the function var(name) should be stored; if var(return) is empty or a single hyphen it is ignored. @@ -4140,10 +4156,12 @@ tt(compadd) when generating matches from the style value, or to the functions for the fields if they are called. ) findex(_describe) -item(tt(_describe) [tt(-12JVx)] [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(_describe )[tt(-12JVx)] [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] [ var(opt) ... ]) +item(SPACES()[ tt(-)tt(-) var(descr) var(name1) [ var(name2) ] [ var(opt) ... ] ... ])( This function associates completions with descriptions. Multiple groups separated by tt(-)tt(-) can be supplied, potentially with -different completion options var(opts). +different completion options var(opt)s. The var(descr) is taken as a string to display above the matches if the tt(format) style for the tt(descriptions) tag is set. This is followed by @@ -4239,11 +4257,11 @@ a similar format; this ensures that user-specified styles are correctly passed down to the builtins which implement the internals of completion. ) findex(_dispatch) -item(tt(_dispatch) var(context string ...))( +item(tt(_dispatch) var(context string) ...)( This sets the current context to var(context) and looks for completion functions to handle this context by hunting through the list of command names or special contexts (as described above for tt(compdef)) -given as var(string ...). The first completion function to be defined +given as var(string)s. The first completion function to be defined for one of the contexts in the list is used to generate matches. Typically, the last var(string) is tt(-default-) to cause the function for default completion to be used as a fallback. @@ -4360,7 +4378,7 @@ Like other utility functions, this function accepts the `tt(-V)', them to the tt(compadd) builtin. ) findex(_next_label) -item(tt(_next_label) [ tt(-x) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) [ var(options) ... ])( +item(tt(_next_label) [ tt(-x) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) [ var(option) ... ])( This function is used to implement the loop over different tag labels for a particular tag as described above for the tt(tag-order) style. On each call it checks to see if there are any more tag labels; if @@ -4374,7 +4392,7 @@ replaced by a tag label in this call. Any description given in the tt(tag-order) style is preferred to the var(descr) passed to tt(_next_label). -The var(options) given after the var(descr) +The var(option)s given after the var(descr) are set in the parameter given by var(name), and hence are to be passed to tt(compadd) or whatever function is called to add the matches. @@ -4397,7 +4415,7 @@ return ret) findex(_normal) item(tt(_normal))( This is the standard function called to handle completion outside -any special var(-context-). It is called both to complete the command +any special tt(-)var(context)tt(-). It is called both to complete the command word and also the arguments for a command. In the second case, tt(_normal) looks for a special completion for that command, and if there is none it uses the completion for the tt(-default-) context. @@ -4493,8 +4511,9 @@ tt(ambiguous), tt(special-dirs), tt(list-suffixes) and tt(file-sort) described above. ) findex(_pick_variant) -xitem(tt(_pick_variant) [ tt(-b) var(builtin-label) ] [ tt(-c) var(command) ] [ tt(-r) var(name) ]) -item( var(label)tt(=)var(pattern) ... var(label) [ var(args) ... ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(_pick_variant )[ tt(-b) var(builtin-label) ] [ tt(-c) var(command) ] [ tt(-r) var(name) ]) +item(SPACES()var(label)tt(=)var(pattern) ... var(label) [ var(arg) ... ])( This function is used to resolve situations where a single command name requires more than one type of handling, either because it has more than one variant or because there is a name clash between two @@ -4505,8 +4524,8 @@ tt(words) unless this is overridden by the option tt(-c). This command is run and its output is compared with a series of patterns. Arguments to be passed to the command can be specified at the end after all the other arguments. The patterns to try in order are given by the arguments -var(label)tt(=)var(pattern); if the output of `var(command) var(args) -tt(...)' contains var(pattern), then tt(label) is selected as the label +var(label)tt(=)var(pattern); if the output of `var(command) var(arg) +...' contains var(pattern), then var(label) is selected as the label for the command variant. If none of the patterns match, the final command label is selected and status 1 is returned. @@ -4517,13 +4536,13 @@ the label var(builtin-label) is selected as the label for the variant. If the `tt(-r) var(name)' is given, the var(label) picked is stored in the parameter named var(name). -The results are also cached in the var(_cmd_variant) associative array +The results are also cached in the tt(_cmd_variant) associative array indexed by the name of the command run. ) findex(_regex_arguments) item(tt(_regex_arguments) var(name) var(spec) ...)( This function generates a completion function var(name) which matches -the specifications var(spec) tt(...), a set of regular expressions as +the specifications var(spec)s, a set of regular expressions as described below. After running tt(_regex_arguments), the function var(name) should be called as a normal completion function. The pattern to be matched is given by the contents of @@ -4610,7 +4629,7 @@ their own arguments as a command line argument. Examples: example(_regex_arguments _tst /$'[^\0]#\0'/ \ -/$'[^\0]#\0'/ :'compadd aaa') + /$'[^\0]#\0'/ :'compadd aaa') This generates a function tt(_tst) that completes tt(aaa) as its only argument. The var(tag) and var(description) for the action have been @@ -4620,14 +4639,14 @@ second matches any argument. As the argument is also arbitrary, any following component would not depend on tt(aaa) being present. example(_regex_arguments _tst /$'[^\0]#\0'/ \ -/$'aaa\0'/ :'compadd aaa') + /$'aaa\0'/ :'compadd aaa') This is a more typical use; it is similar, but any following patterns would only match if tt(aaa) was present as the first argument. example(_regex_arguments _tst /$'[^\0]#\0'/ \( \ -/$'aaa\0'/ :'compadd aaa' \ -/$'bbb\0'/ :'compadd bbb' \) \#) + /$'aaa\0'/ :'compadd aaa' \ + /$'bbb\0'/ :'compadd bbb' \) \#) In this example, an indefinite number of command arguments may be completed. Odd arguments are completed as tt(aaa) and even arguments @@ -4635,8 +4654,8 @@ as tt(bbb). Completion fails unless the set of tt(aaa) and tt(bbb) arguments before the current one is matched correctly. example(_regex_arguments _tst /$'[^\0]#\0'/ \ -\( /$'aaa\0'/ :'compadd aaa' \| \ -/$'bbb\0'/ :'compadd bbb' \) \#) + \( /$'aaa\0'/ :'compadd aaa' \| \ + /$'bbb\0'/ :'compadd bbb' \) \#) This is similar, but either tt(aaa) or tt(bbb) may be completed for any argument. In this case tt(_regex_words) could be used to generate @@ -4696,7 +4715,7 @@ array tt(mydb_add_cmds), quite possibly by a previous call to tt(_regex_words). ) findex(_requested) -item(tt(_requested) [ tt(-x) ] [ tt(-12VJ) ] var(tag) [ var(name) var(descr) [ var(command) var(args) ... ] ])( +item(tt(_requested) [ tt(-x) ] [ tt(-12VJ) ] var(tag) [ var(name) var(descr) [ var(command) [ var(arg) ... ] ])( This function is called to decide whether a tag already registered by a call to tt(_tags) (see below) has been requested by the user and hence completion should be performed for it. It returns status zero if the @@ -4794,7 +4813,7 @@ This function is called automatically from tt(_description) and hence is not normally called explicitly. ) findex(_store_cache) -item(tt(_store_cache) var(cache_identifier) var(params) ...)( +item(tt(_store_cache) var(cache_identifier) var(param) ...)( This function, together with tt(_retrieve_cache) and tt(_cache_invalid), implements a caching layer which can be used in any completion function. Data obtained by @@ -4806,7 +4825,7 @@ even in different instances of the shell. The var(cache_identifier) specifies the file which the data should be dumped to. The file is stored in a directory specified by the tt(cache-path) style which defaults to tt(~/.zcompcache). The remaining -var(params) arguments are the parameters to dump to the file. +var(param)s arguments are the parameters to dump to the file. The return status is zero if storage was successful. The function will only attempt storage if the tt(use-cache) style is set, so you can @@ -4823,7 +4842,7 @@ See the _perl_modules completion function for a simple example of the usage of the caching layer. ) findex(_tags) -item(tt(_tags) [ [ tt(-C) var(name) ] var(tags) ... ])( +item(tt(_tags) [ [ tt(-C) var(name) ] var(tag) ... ])( If called with arguments, these are taken to be the names of tags valid for completions in the current context. These tags are stored internally and sorted by using the tt(tag-order) style. @@ -4938,7 +4957,7 @@ In that case the parameter tt(curcontext) should be made local instead of tt(context) (as described above). ) findex(_wanted) -item(tt(_wanted) [ tt(-x) ] [ tt(-C) var(name) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) var(command) var(args) ...)( +item(tt(_wanted) [ tt(-x) ] [ tt(-C) var(name) ] [ tt(-12VJ) ] var(tag) var(name) var(descr) var(command) [ var(arg) ...])( In many contexts, completion can only generate one particular set of matches, usually corresponding to a single tag. However, it is still necessary to decide whether the user requires matches of this type. diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index 37a568f58..0c0a15d41 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -59,8 +59,8 @@ texinode(Completion Special Parameters)(Completion Builtin Commands)()(Completio sect(Completion Special Parameters) The parameters tt(ZLE_REMOVE_SUFFIX_CHARS) and tt(ZLE_SPACE_SUFFIX_CHARS) -are used by the completion mechanism, but are not special. -ifzman(See em(Parameters Used By The Shell) in zmanref(zshparam))\ +are used by the completion mechanism, but are not special. See +ifzman(em(Parameters Used By The Shell) in zmanref(zshparam))\ ifnzman(noderef(Parameters Used By The Shell)). Inside completion widgets, and any functions called from them, some @@ -445,16 +445,17 @@ sect(Completion Builtin Commands) startitem() findex(compadd) cindex(completion widgets, adding specified matches) -xitem(tt(compadd) [ tt(-akqQfenUld12C) ] [ tt(-F) var(array) ]) -xitem([ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ]) -xitem([ tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ]) -xitem([ tt(-i) var(ignored-prefix) ] [ tt(-I) var(ignored-suffix) ]) -xitem([ tt(-W) var(file-prefix) ] [ tt(-d) var(array) ]) -xitem([ tt(-J) var(name) ] [ tt(-V) var(name) ] [ tt(-X) var(explanation) ] [ tt(-x) var(message) ]) -xitem([ tt(-r) var(remove-chars) ] [ tt(-R) var(remove-func) ]) -xitem([ tt(-D) var(array) ] [ tt(-O) var(array) ] [ tt(-A) var(array) ]) -xitem([ tt(-E) var(number) ]) -item([ tt(-M) var(match-spec) ] [ tt(-)tt(-) ] [ var(words) ... ])( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(compadd )[ tt(-akqQfenUlo12C) ] [ tt(-F) var(array) ]) +xitem(SPACES()[tt(-P) var(prefix) ] [ tt(-S) var(suffix) ]) +xitem(SPACES()[tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ]) +xitem(SPACES()[tt(-i) var(ignored-prefix) ] [ tt(-I) var(ignored-suffix) ]) +xitem(SPACES()[tt(-W) var(file-prefix) ] [ tt(-d) var(array) ]) +xitem(SPACES()[tt(-J) var(name) ] [ tt(-V) var(name) ] [ tt(-X) var(explanation) ] [ tt(-x) var(message) ]) +xitem(SPACES()[tt(-r) var(remove-chars) ] [ tt(-R) var(remove-func) ]) +xitem(SPACES()[tt(-D) var(array) ] [ tt(-O) var(array) ] [ tt(-A) var(array) ]) +xitem(SPACES()[tt(-E) var(number) ]) +item(SPACES()[tt(-M) var(match-spec) ] [ tt(-)tt(-) ] [ var(words) ... ])( This builtin command can be used to add matches directly and control all the information the completion code stores with each possible @@ -687,7 +688,7 @@ match. If no string is given, it will be shown as a string containing the strings that would be inserted for the other matches, truncated to the width of the screen. ) -item(tt(-E))( +item(tt(-E) var(number))( This option adds var(number) empty matches after the var(words) have been added. An empty match takes up space in completion listings but will never be inserted in the line and can't be selected with menu @@ -821,7 +822,7 @@ texinode(Completion Condition Codes)(Completion Matching Control)(Completion Bui sect(Completion Condition Codes) cindex(completion widgets, condition codes) -The following additional condition codes for use within the tt([[ ... ]]) +The following additional condition codes for use within the tt([[) var(...) tt(]]) construct are available in completion widgets. These work on the special parameters. All of these tests can also be performed by the tt(compset) builtin, but in the case of the condition codes the contents of the special @@ -937,9 +938,9 @@ like normal character classes. In anchor patterns correspondence classes also behave like normal character classes. The standard `tt([:)var(name)tt(:])' forms described for standard shell -patterns, +patterns (see ifnzman(noderef(Filename Generation))\ -ifzman(see the section FILENAME GENERATION in zmanref(zshexpn)), +ifzman(the section FILENAME GENERATION in zmanref(zshexpn))) may appear in correspondence classes as well as normal character classes. The only special behaviour in correspondence classes is if the form on the left and the form on the right are each one of diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo index d04ceb258..3d369fb83 100644 --- a/Doc/Zsh/cond.yo +++ b/Doc/Zsh/cond.yo @@ -123,7 +123,7 @@ tt(MATCH) is set to the substring that matched the pattern and the integer parameters tt(MBEGIN) and tt(MEND) to the index of the start and end, respectively, of the match in var(string), such that if var(string) is contained in variable tt(var) the expression -`${var[$MBEGIN,$MEND]}' is identical to `$MATCH'. The setting +`tt(${var[$MBEGIN,$MEND]})' is identical to `tt($MATCH)'. The setting of the option tt(KSH_ARRAYS) is respected. Likewise, the array tt(match) is set to the substrings that matched parenthesised subexpressions and the arrays tt(mbegin) and tt(mend) to the indices of @@ -132,9 +132,9 @@ var(string). The arrays are not set if there were no parenthesised subexpresssions. For example, if the string `tt(a short string)' is matched against the regular expression `tt(s+LPAR()...RPAR()t)', then (assuming the option tt(KSH_ARRAYS) is not set) tt(MATCH), tt(MBEGIN) -and tt(MEND) are `tt(short)', 3 and 7, respectively, while tt(match), +and tt(MEND) are `tt(short)', tt(3) and tt(7), respectively, while tt(match), tt(mbegin) and tt(mend) are single entry arrays containing -the strings `tt(hor)', `tt(4)' and `tt(6), respectively. +the strings `tt(hor)', `tt(4)' and `tt(6)', respectively. If the option tt(BASH_REMATCH) is set the array tt(BASH_REMATCH) is set to the substring that matched the pattern @@ -216,7 +216,7 @@ test command. For example, -tt([[ -n file*(#qN) ]]) +example([[ -n file*(#qN) ]]) produces status zero if and only if there is at least one file in the current directory beginning with the string `tt(file)'. The globbing @@ -243,7 +243,8 @@ even if the underlying system does not support the tt(/dev/fd) directory. In the forms which do numeric comparison, the expressions var(exp) -undergo arithmetic expansion as if they were enclosed in tt($((...))). +undergo arithmetic expansion as if they were enclosed in +tt($LPAR()LPAR())var(...)tt(RPAR()RPAR()). For example, the following: diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 24be63eb9..8b6b7d3b7 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -98,7 +98,7 @@ be used to keep function digests up to date. startitem() findex(zrecompile) xitem(tt(zrecompile) [ tt(-qt) ] [ var(name) ... ]) -item(tt(zrecompile) [ tt(-qt) ] tt(-p) var(args) [ tt(-)tt(-) var(args) ... ])( +item(tt(zrecompile) [ tt(-qt) ] tt(-p) var(arg) ... [ tt(-)tt(-) var(arg) ... ])( This tries to find tt(*.zwc) files and automatically re-compile them if at least one of the original files is newer than the compiled file. This works only if the names stored in the compiled files are full paths or are @@ -118,7 +118,7 @@ Without the tt(-t) option, the return status is zero if all files that needed re-compilation could be compiled and non-zero if compilation for at least one of the files failed. -If the tt(-p) option is given, the var(args) are interpreted as one +If the tt(-p) option is given, the var(arg)s are interpreted as one or more sets of arguments for tt(zcompile), separated by `tt(-)tt(-)'. For example: @@ -174,7 +174,7 @@ findex(zkbd) The large number of possible combinations of keyboards, workstations, terminals, emulators, and window systems makes it impossible for zsh to have built-in key bindings for every situation. The tt(zkbd) utility, -found in Functions/Misc, can help you quickly create key bindings for your +found in tt(Functions/Misc), can help you quickly create key bindings for your configuration. Run tt(zkbd) either as an autoloaded function, or as a shell script: @@ -291,7 +291,7 @@ cindex(hook function utility) startitem() findex(add-zsh-hook) -item(tt(add-zsh-hook) [-dD] var(hook) var(function))( +item(tt(add-zsh-hook) [ tt(-dD) ] [ tt(-Uzk) ] var(hook) var(function))( Several functions are special to the shell, as described in the section ifnzman(Special Functions, noderef(Functions))\ ifzman(SPECIAL FUNCTIONS, see zmanref(zshmisc)), @@ -635,7 +635,7 @@ PS1='%F{5}[%F{2}%n%F{5}] %F{3}%3~ ${vcs_info_msg_0_}%f%# ') Obviously, the last two lines are there for demonstration. You need to call tt(vcs_info) from your tt(precmd) function. Once that is done you need -a tt(single quoted) tt('${vcs_info_msg_0_}') in your prompt. +a em(single quoted) tt('${vcs_info_msg_0_}') in your prompt. To be able to use tt('${vcs_info_msg_0_}') directly in your prompt like this, you will need to have the tt(PROMPT_SUBST) option enabled. @@ -865,7 +865,7 @@ in the repository. kindex(command) item(tt(command))( This style causes tt(vcs_info) to use the supplied string as the command -to use as the VCS's binary. Note, that setting this in ':vcs_info:*' is +to use as the VCS's binary. Note, that setting this in 'tt(:vcs_info:*)' is not a good idea. If the value of this style is empty (which is the default), the used binary @@ -1219,12 +1219,12 @@ without restarting the shell. ) enditem() -All functions named VCS_INFO_* are for internal use only. +All functions named tt(VCS_INFO_*) are for internal use only. subsect(Variable Description) startitem() -item(tt(${vcs_info_msg_)var(N)tt(_}) (Note the trailing underscore)) +item(tt(${vcs_info_msg_)var(N)tt(_)}) (Note the trailing underscore)) ( Where var(N) is an integer, e.g., tt(vcs_info_msg_0_). These variables are the storage for the informational message the last tt(vcs_info) call @@ -1237,7 +1237,7 @@ exported into the environment. (See the tt(max-exports) style above.) ) enditem() -All variables named VCS_INFO_* are for internal use only. +All variables named tt(VCS_INFO_*) are for internal use only. subsect(Hooks in vcs_info) @@ -1256,7 +1256,7 @@ example(zstyle ':vcs_info:*+foo:*' hooks bar baz) This registers functions to the hook `foo' for all backends. In order to avoid namespace problems, all registered function names are prepended by -a `+vi-', so the actual functions called for the `foo' hook are +a `tt(+vi-)', so the actual functions called for the `foo' hook are `tt(+vi-bar)' and `tt(+vi-baz)'. If you would like to register a function to a hook regardless of the @@ -1377,7 +1377,7 @@ tt(patch-format) and tt(nopatch-format) styles. item(tt(no-vcs))( This hooks is called when no version control system was detected. -The `hook_com' parameter is not used. +The `tt(hook_com)' parameter is not used. ) item(tt(post-backend))( Called as soon as the backend has finished collecting information. @@ -1442,8 +1442,8 @@ will be used unchanged instead of an expanded format from tt(patch-format) or tt(nopatch-format). ) item(tt(set-message))( -Called each time before a `tt(vcs_info_msg_N_)' message is set. -It takes two arguments; the first being the `N' in the message +Called each time before a `tt(vcs_info_msg_)var(N)tt(_)' message is set. +It takes two arguments; the first being the `var(N)' in the message variable name, the second is the currently configured tt(formats) or tt(actionformats). @@ -1468,8 +1468,8 @@ tt(vcs_info). ) enditem() -If all of this sounds rather confusing, take a look at the tt(Examples) -section below and also in the Misc/vcs_info-examples file in the Zsh source. +If all of this sounds rather confusing, take a look at the bf(Examples) +section below and also in the tt(Misc/vcs_info-examples) file in the Zsh source. They contain some explanatory code. subsect(Examples) @@ -1487,8 +1487,8 @@ Provide a special formats for tt(git): example(zstyle ':vcs_info:git:*' formats ' GIT, BABY! [%b]' zstyle ':vcs_info:git:*' actionformats ' GIT ACTION! [%b|%a]') -All tt(%x) expansion in all sorts of formats ("formats", "actionformats", -branchformat, you name it) are done using the `tt(zformat)' builtin from +All tt(%x) expansion in all sorts of formats (tt(formats), tt(actionformats), +tt(branchformat), you name it) are done using the `tt(zformat)' builtin from the `tt(zsh/zutil)' module. That means you can do everything with these tt(%x) items what zformat supports. In particular, if you want something that is really long to have a fixed width, like a hash in a mercurial @@ -1504,16 +1504,17 @@ example(zstyle ':vcs_info:bzr:*' use-simple true) If you do use tt(use-simple), please report if it does `the-right-thing[tm]'. Display the revision number in yellow for tt(bzr) and tt(svn): -example(zstyle ':vcs_info:(svn|bzr):*' branchformat '%b%{'${fg[yellow]}'%}:%r') +example(zstyle ':vcs_info:(svn|bzr):*' \ + branchformat '%b%{'${fg[yellow]}'%}:%r') -If you want colors, make sure you enclose the color codes in tt(%{...%}) +If you want colors, make sure you enclose the color codes in tt(%{)var(...)tt(%}) if you want to use the string provided by tt(vcs_info) in prompts. Here is how to print the VCS information as a command (not in a prompt): example(alias vcsi='vcs_info command; vcs_info_lastmsg') This way, you can even define different formats for output via -tt(vcs_info_lastmsg) in the ':vcs_info:*:command:*' namespace. +tt(vcs_info_lastmsg) in the 'tt(:vcs_info:*:command:*)' namespace. Now as promised, some code that uses hooks: say, you'd like to replace the string `svn' by `subversion' in @@ -1846,7 +1847,8 @@ Neither of the styles tt(word-chars) nor tt(word-class) is used in this case. Here are some examples of use of the tt(word-context) style to extend the context. -example(zstyle ':zle:*' word-context "*/*" file "[[:space:]]" whitespace +example(zstyle ':zle:*' word-context \ + "*/*" file "[[:space:]]" whitespace zstyle ':zle:transpose-words:whitespace' word-style shell zstyle ':zle:transpose-words:filename' word-style normal zstyle ':zle:transpose-words:filename' word-chars '') @@ -2268,8 +2270,9 @@ using a two-character mnemonic. ) tindex(narrow-to-region) tindex(narrow-to-region-invisible) -xitem(tt(narrow-to-region [ -p) var(pre) tt(] [ -P) var(post) tt(])) -xitem( tt([ -S) var(statepm) tt(| -R) var(statepm) tt(] [ -n ] [) var(start) var(end) tt(]))) +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(narrow-to-region )[ tt(-p) var(pre) ] [ tt(-P) var(post) ]) +xitem(SPACES()[ tt(-S) var(statepm) | tt(-R) var(statepm) ] [ tt(-n) ] [ var(start) var(end) ]) item(tt(narrow-to-region-invisible))( Narrow the editable portion of the buffer to the region between the cursor and the mark, which may be in either order. The region may not be empty. @@ -2920,8 +2923,8 @@ command to an appropriate viewer. startitem() findex(zsh-mime-setup) findex(zsh-mime-handler) -xitem(tt(zsh-mime-setup) [ tt(-fv) ] [ tt(-l) [ var(suffix ...) ] ]) -item(tt(zsh-mime-handler [-l] var(command arguments ...)))( +xitem(tt(zsh-mime-setup) [ tt(-fv) ] [ tt(-l) [ var(suffix) ... ] ]) +item(tt(zsh-mime-handler) [ tt(-l) ] var(command argument) ...)( These two functions use the files tt(~/.mime.types) and tt(/etc/mime.types), which associate types and extensions, as well as tt(~/.mailcap) and tt(/etc/mailcap) files, which associate types and the programs that @@ -3805,11 +3808,13 @@ ifzman(above)\ ifnzman((noderef(Utilities))). ) findex(zmv) -item(tt(zmv) [ tt(-finqQsvwW) ] [ -C | -L | -M | -[pP] var(program) ] [ -o var(optstring) ] var(srcpat) var(dest) )( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ ))ifnztexi( ))) +xitem(tt(zmv) [ tt(-finqQsvwW) ] [ tt(-C) | tt(-L) | tt(-M) | -{tt(p)|tt(P)} var(program) ] [ tt(-o) var(optstring) ]) +item(SPACES()var(srcpat) var(dest) )( Move (usually, rename) files matching the pattern var(srcpat) to corresponding files having names of the form given by var(dest), where var(srcpat) contains parentheses surrounding patterns which will be -replaced in turn by $1, $2, ... in var(dest). For example, +replaced in turn by tt($1), tt($2), ... in var(dest). For example, example(zmv '(*).lis' '$1.txt') @@ -3829,7 +3834,7 @@ sitem(tt(-f))(Force overwriting of destination files. Not currently passed down to the tt(mv)/tt(cp)/tt(ln) command due to vagaries of implementations (but you can use tt(-o-f) to do that).) sitem(tt(-i))(Interactive: show each line to be executed and ask the user -whether to execute it. `Y' or `y' will execute it, anything else will +whether to execute it. `tt(Y)' or `tt(y)' will execute it, anything else will skip it. Note that you just need to type one character.) sitem(tt(-n))(No execution: print what would happen, but don't do it.) sitem(tt(-q))(Turn bare glob qualifiers off: now assumed by default, so @@ -3841,7 +3846,7 @@ sitem(tt(-v))(Verbose: print each command as it's being executed.) sitem(tt(-w))(Pick out wildcard parts of the pattern, as described above, and implicitly add parentheses for referring to them.) sitem(tt(-W))(Just like tt(-w), with the addition of turning wildcards in -the replacement pattern into sequential ${1} .. ${N} references.) +the replacement pattern into sequential tt(${1}) .. tt(${N}) references.) sxitem(tt(-C)) sxitem(tt(-L)) sitem(tt(-M))(Force tt(cp), tt(ln) or tt(mv), respectively, regardless of @@ -3879,18 +3884,18 @@ ifzman(above)\ ifnzman((noderef(Utilities))). ) findex(zstyle+) -item(tt(zstyle+) var(context) var(style) var(value) [ + var(subcontext) var(style) var(value) ... ])( +item(tt(zstyle+) var(context) var(style) var(value) [ tt(+) var(subcontext) var(style) var(value) ... ])( This makes defining styles a bit simpler by using a single `tt(+)' as a special token that allows you to append a context name to the previously used context name. Like this: -example(zstyle+ ':foo:bar' style1 value1 \ - + ':baz' style2 value2 \ - + ':frob' style3 value3) +example(zstyle+ ':foo:bar' var(style1) var(value1) \ + + ':baz' var(style2) var(value2) \ + + ':frob' var(style3) var(value3)) -This defines `style1' with `value1' for the context tt(:foo:bar) as usual, -but it also defines `style2' with `value2' for the context -tt(:foo:bar:baz) and `style3' with `value3' for tt(:foo:bar:frob). Any +This defines var(style1) with var(value1) for the context tt(:foo:bar) as usual, +but it also defines var(style2) with var(value2) for the context +tt(:foo:bar:baz) and var(style3) with var(value3) for tt(:foo:bar:frob). Any var(subcontext) may be the empty string to re-use the first context unchanged. ) diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 8728803e0..afd6b1ff9 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -943,7 +943,7 @@ item(tt(F))( Join the words of arrays together using newline as a separator. This is a shorthand for `tt(pj:\n:)'. ) -item(tt(g:opts:))( +item(tt(g:)var(opts)tt(:))( Process escape sequences like the echo builtin when no options are given (tt(g::)). With the tt(o) option, octal escapes don't take a leading zero. With the tt(c) option, sequences like `tt(^X)' are also processed. @@ -1014,6 +1014,25 @@ form of single quoting is used that only quotes the string if needed to protect special characters. Typically this form gives the most readable output. ) +item(tt(b))( +Quote with backslashes only characters that are special to pattern +matching. This is useful when the contents of the variable are to be +tested using tt(GLOB_SUBST), including the tt(${~)var(...)tt(}) switch. + +Quoting using one of the tt(q) family of flags does not work +for this purpose since quotes are not stripped from non-pattern +characters by tt(GLOB_SUBST). In other words, + +example(pattern=${(q)str} +[[ $str = ${~pattern} ]]) + +works if tt($str) is tt('a*b') but not if it is tt('a b'), whereas + +example(pattern=${(b)str} +[[ $str = ${~pattern} ]]) + +is always true for any possible value of tt($str). +) item(tt(Q))( Remove one level of quotes from the resulting words. ) @@ -1147,7 +1166,9 @@ be treated as patterns. This applies to the string arguments of flags that follow tt(~) within the same set of parentheses. Compare with tt(~) outside parentheses, which forces the entire substituted string to be treated as a pattern. Hence, for example, + example([[ "?" = ${(~j.|.)array} ]]) + treats `tt(|)' as a pattern and succeeds if and only if tt($array) contains the string `tt(?)' as an element. The tt(~) may be repeated to toggle the behaviour; its effect only lasts to the @@ -1168,11 +1189,11 @@ optional; neither, the first, or both may be given. Note that the same pairs of delimiters must be used for each of the three arguments. The space to the left will be filled with var(string1) (concatenated as often as needed) or spaces if var(string1) is not given. If both -var(string1) and var(string2) are given, tt(string2) is inserted once +var(string1) and var(string2) are given, var(string2) is inserted once directly to the left of each word, truncated if necessary, before var(string1) is used to produce any remaining padding. -If either of var(string1) or tt(string2) is present but empty, +If either of var(string1) or var(string2) is present but empty, i.e. there are two delimiters together at that point, the first character of tt($IFS) is used instead. @@ -1230,7 +1251,7 @@ example(line="one::three" print -l "${(s.:.)line}") produces two lines of output for tt(one) and tt(three) and elides the -empty field. To override this behaviour, supply the "(@)" flag as well, +empty field. To override this behaviour, supply the `tt((@))' flag as well, i.e. tt("${(@s.:.)line}"). ) item(tt(Z:)var(opts)tt(:))( @@ -1314,14 +1335,14 @@ enditem() subsect(Rules) Here is a summary of the rules for substitution; this assumes that braces -are present around the substitution, i.e. tt(${...}). Some particular +are present around the substitution, i.e. tt(${)var(...)tt(}). Some particular examples are given below. Note that the Zsh Development Group accepts em(no responsibility) for any brain damage which may occur during the reading of the following rules. startitem() item(tt(1.) em(Nested substitution))( -If multiple nested tt(${...}) forms are present, substitution is +If multiple nested tt(${)var(...)tt(}) forms are present, substitution is performed from the inside outwards. At each level, the substitution takes account of whether the current value is a scalar or an array, whether the whole substitution is in double quotes, and what flags are supplied to the @@ -2233,7 +2254,7 @@ tt(readme) with up to two errors. When using the ksh syntax for grouping both tt(KSH_GLOB) and tt(EXTENDED_GLOB) must be set and the left parenthesis should be preceded by tt(@). Note also that the flags do not affect letters -inside tt([...]) groups, in other words tt(LPAR()#i)tt(RPAR()[a-z]) +inside tt([)...tt(]) groups, in other words tt(LPAR()#i)tt(RPAR()[a-z]) still matches only lowercase letters. Finally, note that when examining whole paths case-insensitively every directory must be searched for all files which match, so that a pattern of the form @@ -2344,7 +2365,8 @@ the glob pattern by doubling the parentheses, in this case producing `tt(((^x)))'. If the option tt(EXTENDED_GLOB) is set, a different syntax for glob -qualifiers is available, namely `tt((#qx))' where tt(x) is any of the same +qualifiers is available, namely `tt(LPAR()#q)var(x)tt(RPAR())' +where var(x) is any of the same glob qualifiers used in the other format. The qualifiers must still appear at the end of the pattern. However, with this syntax multiple glob qualifiers may be chained together. They are treated as a logical AND of @@ -2357,7 +2379,7 @@ the pattern, for example `tt(*(#q*)(.))' will recognise executable regular files if both options are set; however, mixed syntax should probably be avoided for the sake of clarity. Note that within conditions using the `tt([[)' form the presence of a parenthesised expression -tt(LPAR()#q...+RPAR()) at the end of a string indicates that globbing +tt(LPAR()#q)var(...)tt(RPAR()) at the end of a string indicates that globbing should be performed; the expression may include glob qualifiers, but it is also valid if it is simply tt(LPAR()#q+RPAR()). This does not apply to the right hand side of pattern match operators as the @@ -2694,14 +2716,15 @@ whole list matches if at least one of the sublists matches (they are however, affect all matches generated, independent of the sublist in which they are given. These are the qualifiers `tt(M)', `tt(T)', `tt(N)', `tt(D)', `tt(n)', `tt(o)', `tt(O)' and the subscripts given -in brackets (`tt([...])'). +in brackets (`tt([)var(...)tt(])'). If a `tt(:)' appears in a qualifier list, the remainder of the expression in parenthesis is interpreted as a modifier (see noderef(Modifiers) in noderef(History Expansion)). Each modifier must be introduced by a separate `tt(:)'. Note also that the result after modification does not have to be an existing file. The name of any existing file can be followed -by a modifier of the form `tt((:..))' even if no actual filename generation +by a modifier of the form `tt(LPAR():)var(...)tt(RPAR())' +even if no actual filename generation is performed, although note that the presence of the parentheses causes the entire expression to be subjected to any global pattern matching options such as tt(NULL_GLOB). Thus: diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo index 522ad0472..4476fc392 100644 --- a/Doc/Zsh/grammar.yo +++ b/Doc/Zsh/grammar.yo @@ -191,7 +191,7 @@ use the positional parameters instead of the var(word)s. More than one parameter var(name) can appear before the list of var(word)s. If var(N) var(name)s are given, then on each execution of the -loop the next tt(N) var(word)s are assigned to the corresponding +loop the next var(N) var(word)s are assigned to the corresponding parameters. If there are more var(name)s than remaining var(word)s, the remaining parameters are each set to the empty string. Execution of the loop ends when there is no remaining var(word) to assign to the first @@ -239,11 +239,17 @@ item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) Execute the var(list) associated with the first var(pattern) that matches var(word), if any. The form of the patterns is the same as that used for filename generation. See -noderef(Filename Generation). Note further that the whole -pattern with alternatives is treated by the shell as equivalent -to a group of patterns within parentheses, even though in -the tt(case) syntax whitespace may appear about the parentheses and the -vertical bar. +noderef(Filename Generation). + +Note further that, unless the tt(SH_GLOB) option is set, the whole +pattern with alternatives is treated by the shell as equivalent to a +group of patterns within parentheses, although white space may appear +about the parentheses and the vertical bar and will be stripped from the +pattern at those points. White space may appear elsewhere in the +pattern; this is not stripped. If the tt(SH_GLOB) option is set, so +that an opening parenthesis can be unambiguously treated as part of the +case syntax, the expression is parsed into separate words and these are +treated as strict alternatives (as in other shells). If the var(list) that is executed is terminated with tt(;&) rather than tt(;;), the following list is also executed. The rule for @@ -353,7 +359,7 @@ The body of the function is the var(list) between the tt({) and tt(}). See noderef(Functions). If the option tt(SH_GLOB) is set for compatibility with other shells, then -whitespace may appear between between the left and right parentheses when +whitespace may appear between the left and right parentheses when there is a single var(word); otherwise, the parentheses will be treated as forming a globbing pattern in that case. @@ -396,8 +402,9 @@ code is a concern. The short versions below only work if var(sublist) is of the form `tt({) var(list) tt(})' or if the tt(SHORT_LOOPS) option is set. For the tt(if), tt(while) and tt(until) commands, in both these cases the test part of the -loop must also be suitably delimited, such as by `tt([[ ... ]])' or `tt((( -... )))', else the end of the test will not be recognized. For the +loop must also be suitably delimited, such as by `tt([[) var(...) tt(]])' or +`tt(LPAR()LPAR()) var(...) tt(RPAR()RPAR())', +else the end of the test will not be recognized. For the tt(for), tt(repeat), tt(case) and tt(select) commands no such special form for the arguments is necessary, but the other condition (the special form of var(sublist) or use of the tt(SHORT_LOOPS) option) still applies. @@ -420,7 +427,7 @@ example(if true { # Does not work! does em(not), since the test is not suitably delimited. ) item(tt(if) var(list) var(sublist))( -A short form of the alternate `if'. The same limitations on the form of +A short form of the alternate tt(if). The same limitations on the form of var(list) apply as for the previous form. ) item(tt(for) var(name) ... tt(LPAR()) var(word) ... tt(RPAR()) var(sublist))( @@ -451,7 +458,7 @@ This is a short form of tt(repeat). item(tt(case) var(word) tt({) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)|tt(;|)) ] ... tt(}))( An alternative form of tt(case). ) -item(tt(select) var(name) [ tt(in) var(word) var(term) ] var(sublist))( +item(tt(select) var(name) [ tt(in) var(word) ... var(term) ] var(sublist))( where var(term) is at least one newline or tt(;). A short form of tt(select). ) @@ -617,7 +624,7 @@ code fragment might be re-executed. texinode(Quoting)()(Aliasing)(Shell Grammar) sect(Quoting) cindex(quoting) -A character may be var(quoted) (that is, made +A character may be em(quoted) (that is, made to stand for itself) by preceding it with a `tt(\)'. `tt(\)' followed by a newline is ignored. diff --git a/Doc/Zsh/mod_clone.yo b/Doc/Zsh/mod_clone.yo index a0bf42b17..02dc5be0e 100644 --- a/Doc/Zsh/mod_clone.yo +++ b/Doc/Zsh/mod_clone.yo @@ -20,7 +20,8 @@ and non-zero on error. The target of tt(clone) should be an unused terminal, such as an unused virtual console or a virtual terminal created by -xterm -e sh -c 'trap : INT QUIT TSTP; tty; while :; do sleep 100000000; done' +example(xterm -e sh -c 'trap : INT QUIT TSTP; tty; + while :; do sleep 100000000; done') Some words of explanation are warranted about this long xterm command line: when doing clone on a pseudo-terminal, some other session @@ -28,14 +29,15 @@ line: when doing clone on a pseudo-terminal, some other session the terminal. Hence the cloned zsh cannot acquire the pseudo-terminal as a controlling tty. That means two things: - the job control signals will go to the sh-started-by-xterm process - group (that's why we disable INT QUIT and TSTP with trap; otherwise - the while loop could get suspended or killed) +startitemize() +itemiz(the job control signals will go to the sh-started-by-xterm process +group (that's why we disable INT QUIT and TSTP with trap; otherwise +the while loop could get suspended or killed)) +itemiz(the cloned shell will have job control disabled, and the job +control keys (control-C, control-\ and control-Z) will not work.) +enditemize() - the cloned shell will have job control disabled, and the job - control keys (control-C, control-\ and control-Z) will not work. - -This does not apply when cloning to an bf(unused) vc. +This does not apply when cloning to an em(unused) vc. Cloning to a used (and unprepared) terminal will result in two processes reading simultaneously from the same terminal, with diff --git a/Doc/Zsh/mod_complist.yo b/Doc/Zsh/mod_complist.yo index 09b2b4f8b..164b5b03f 100644 --- a/Doc/Zsh/mod_complist.yo +++ b/Doc/Zsh/mod_complist.yo @@ -22,7 +22,7 @@ are highlighted. To turn on highlighting an empty value suffices, in which case all the default values given below will be used. The format of the value of these parameters is the same as used by the GNU version of the tt(ls) command: a colon-separated list of specifications of the form -`var(name)=var(value)'. The var(name) may be one of the following strings, +`var(name)tt(=)var(value)'. The var(name) may be one of the following strings, most of which specify file types for which the var(value) will be used. The strings and their default values are: @@ -167,7 +167,7 @@ is the empty string, a default prompt will be used. The value may contain escapes of the form `tt(%x)'. It supports the escapes `tt(%B)', `tt(%b)', `tt(%S)', `tt(%s)', `tt(%U)', `tt(%u)', `tt(%F)', `tt(%f)', `tt(%K)', `tt(%k)' and -`tt(%{...%})' used also in shell prompts as well as three pairs of +`tt(%{)var(...)tt(%})' used also in shell prompts as well as three pairs of additional sequences: a `tt(%l)' or `tt(%L)' is replaced by the number of the last line shown and the total number of lines in the form `var(number)tt(/)var(total)'; a `tt(%m)' or `tt(%M)' is replaced with @@ -409,6 +409,6 @@ ifnzman(noderef(The zsh/zle Module))\ ). For example, to make the return key leave menu selection without accepting the match currently selected one could call -indent(tt(bindkey -M menuselect '^M' send-break)) +example(bindkey -M menuselect '^M' send-break) after loading the tt(zsh/complist) module. diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo index 7ad772adb..8104572a6 100644 --- a/Doc/Zsh/mod_curses.yo +++ b/Doc/Zsh/mod_curses.yo @@ -21,11 +21,11 @@ xitem(tt(zcurses) tt(position) var(targetwin) var(array)) xitem(tt(zcurses) tt(char) var(targetwin) var(character) ) xitem(tt(zcurses) tt(string) var(targetwin) var(string) ) xitem(tt(zcurses) tt(border) var(targetwin) var(border) ) -xitem(tt(zcurses) tt(attr) var(targetwin) [ var({+/-}attribute) | var(fg_col)tt(/)var(bg_col) ] [...]) -xitem(tt(zcurses) tt(bg) var(targetwin) [ var({+/-}attribute) | var(fg_col)tt(/)var(bg_col) | tt(@)var(char) ] [...]) -xitem(tt(zcurses) tt(scroll) var(targetwin) [ tt(on) | tt(off) | {+/-}var(lines) ]) +xitem(tt(zcurses) tt(attr) var(targetwin) [ [tt(+)|tt(-)]var(attribute) | var(fg_col)tt(/)var(bg_col) ] [...]) +xitem(tt(zcurses) tt(bg) var(targetwin) [ [tt(+)|tt(-)]var(attribute) | var(fg_col)tt(/)var(bg_col) | tt(@)var(char) ] [...]) +xitem(tt(zcurses) tt(scroll) var(targetwin) [ tt(on) | tt(off) | [tt(+)|tt(-)]var(lines) ]) xitem(tt(zcurses) tt(input) var(targetwin) [ var(param) [ var(kparam) [ var(mparam) ] ] ]) -xitem(tt(zcurses) tt(mouse) [ tt(delay) var(num) | {+/-}tt(motion) ]) +xitem(tt(zcurses) tt(mouse) [ tt(delay) var(num) | [tt(+)|tt(-)]tt(motion) ]) xitem(tt(zcurses) tt(timeout) var(targetwin) var(intval)) item(tt(zcurses) tt(querychar) var(targetwin) [ var(param) ])( Manipulate curses windows. All uses of this command should be @@ -135,7 +135,7 @@ turned tt(on) to allow the window to be scrolled. The subcommand tt(input) reads a single character from the window without echoing it back. If var(param) is supplied the character is assigned to the parameter var(param), else it is assigned to the -parameter var(REPLY). +parameter tt(REPLY). If both var(param) and var(kparam) are supplied, the key is read in `keypad' mode. In this mode special keys such as function keys and diff --git a/Doc/Zsh/mod_parameter.yo b/Doc/Zsh/mod_parameter.yo index 09ceba258..9d1dc8b7d 100644 --- a/Doc/Zsh/mod_parameter.yo +++ b/Doc/Zsh/mod_parameter.yo @@ -151,11 +151,11 @@ item(tt(jobstates))( This associative array gives information about the states of the jobs currently known. The keys are the job numbers and the values are strings of the form -`var(job-state):var(mark):var(pid)tt(=)var(state)tt(...)'. The +`var(job-state)tt(:)var(mark)tt(:)var(pid)tt(=)var(state)...'. The var(job-state) gives the state the whole job is currently in, one of `tt(running)', `tt(suspended)', or `tt(done)'. The var(mark) is `tt(+)' for the current job, `tt(-)' for the previous job and empty -otherwise. This is followed by one `var(pid)tt(=)var(state)' for every +otherwise. This is followed by one `tt(:)var(pid)tt(=)var(state)' for every process in the job. The var(pid)s are, of course, the process IDs and the var(state) describes the state of that process. diff --git a/Doc/Zsh/mod_pcre.yo b/Doc/Zsh/mod_pcre.yo index faada28de..d6b4bd15d 100644 --- a/Doc/Zsh/mod_pcre.yo +++ b/Doc/Zsh/mod_pcre.yo @@ -31,18 +31,18 @@ PCRE. Upon successful match, if the expression captures substrings within parentheses, -tt(pcre_match) will set the array var($match) to those +tt(pcre_match) will set the array tt(match) to those substrings, unless the tt(-a) option is given, in which case it will set the array var(arr). Similarly, the variable -var(MATCH) will be set to the entire matched portion of the +tt(MATCH) will be set to the entire matched portion of the string, unless the tt(-v) option is given, in which case the variable var(var) will be set. No variables are altered if there is no successful match. A tt(-n) option starts searching for a match from the byte var(offset) position in var(string). If the tt(-b) option is given, -the variable var(ZPCRE_OP) will be set to an offset pair string, +the variable tt(ZPCRE_OP) will be set to an offset pair string, representing the byte offset positions of the entire matched portion -within the var(string). For example, a var(ZPCRE_OP) set to "32 45" indicates +within the var(string). For example, a tt(ZPCRE_OP) set to "32 45" indicates that the matched portion began on byte offset 32 and ended on byte offset 44. Here, byte offset position 45 is the position directly after the matched portion. Keep in mind that the byte position isn't necessarily the same @@ -75,7 +75,7 @@ The tt(zsh/pcre) module makes available the following test condition: startitem() findex(pcre-match) -item(expr tt(-pcre-match) pcre)( +item(var(expr) tt(-pcre-match) var(pcre))( Matches a string against a perl-compatible regular expression. For example, diff --git a/Doc/Zsh/mod_sched.yo b/Doc/Zsh/mod_sched.yo index 2d8d77c7a..1350b9e4c 100644 --- a/Doc/Zsh/mod_sched.yo +++ b/Doc/Zsh/mod_sched.yo @@ -8,7 +8,7 @@ startitem() findex(sched) cindex(timed execution) cindex(execution, timed) -xitem(tt(sched) [tt(-o)] [tt(PLUS())]var(hh)tt(:)var(mm)[:var(ss)] var(command) ...) +xitem(tt(sched) [tt(-o)] [tt(PLUS())]var(hh)tt(:)var(mm)[tt(:)var(ss)] var(command) ...) xitem(tt(sched) [tt(-o)] [tt(PLUS())]var(seconds) var(command) ...) item(tt(sched) [ tt(-)var(item) ])( Make an entry in the scheduled list of commands to execute. @@ -54,7 +54,7 @@ tt(sched) builtin. The indices of the array correspond to the numbers shown when tt(sched) is run with no arguments (provided that the tt(KSH_ARRAYS) option is not set). The value of the array consists of the scheduled time in seconds since the epoch -(see ifnzman(The zsh/datetime Module)\ +(see ifnzman(noderef(The zsh/datetime Module))\ ifzman(the section `The zsh/datetime Module') for facilities for using this number), followed by a colon, followed by any options (which may be empty but will be preceded by a `tt(-)' otherwise), diff --git a/Doc/Zsh/mod_stat.yo b/Doc/Zsh/mod_stat.yo index 1c540bbb2..78649de5e 100644 --- a/Doc/Zsh/mod_stat.yo +++ b/Doc/Zsh/mod_stat.yo @@ -9,9 +9,11 @@ findex(zstat) findex(stat) cindex(files, listing) cindex(files, examining) -xitem(tt(zstat) [ tt(-gnNolLtTrs) ] [ tt(-f) var(fd) ] \ +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(zstat )[ tt(-gnNolLtTrs) ] [ tt(-f) var(fd) ] \ [ tt(-H) var(hash) ] [ tt(-A) var(array) ] \ - [ tt(-F) var(fmt) ] [ tt(PLUS())var(element) ] [ var(file) ... ]) + [ tt(-F) var(fmt) ]) +xitem(SPACES()[ tt(PLUS())var(element) ] [ var(file) ... ]) item(tt(stat) var(...))( The command acts as a front end to the tt(stat) system call (see manref(stat)(2)). The same command is provided with two names; as diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo index 7101e37dc..7f9c011a7 100644 --- a/Doc/Zsh/mod_system.yo +++ b/Doc/Zsh/mod_system.yo @@ -8,7 +8,7 @@ subsect(Builtins) startitem() findex(syserror) -item(tt(syserror) tt([ -e) var(errvar) tt(] [ -p) var(prefix) tt(] [) var(errno) tt(|) var(errname) tt(]))( +item(tt(syserror) [ tt(-e) var(errvar) ] [ tt(-p) var(prefix) ] [ var(errno) | var(errname) ])( This command prints out the error message associated with var(errno), a system error number, followed by a newline to standard error. @@ -29,11 +29,12 @@ parameters, and a return status of 2 indicates the error name was not recognised (no message is printed for this). ) findex(sysread) -xitem(tt(sysread [ -c) var(countvar) tt(] [ -i) var(infd) tt(] [ -o) var(outfd) tt(])) -item( tt([ -s) var(bufsize) tt(] [ -t) var(timeout) tt(] [) var(param) tt(]))( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(sysread )[ tt(-c) var(countvar) ] [ tt(-i) var(infd) ] [ tt(-o) var(outfd) ]) +item(SPACES()[ tt(-s) var(bufsize) ] [ tt(-t) var(timeout) ] [ var(param) ])( Perform a single system read from file descriptor var(infd), or zero if that is not given. The result of the read is stored in var(param) or -var(REPLY) if that is not given. If var(countvar) is given, the number +tt(REPLY) if that is not given. If var(countvar) is given, the number of bytes read is assigned to the parameter named by var(countvar). The maximum number of bytes read is var(bufsize) or 8192 if that is not @@ -88,7 +89,7 @@ usual rules; no write to var(outfd) is attempted. ) enditem() ) -item(tt(syswrite [ -c) var(countvar) tt(] [ -o) var(outfd) tt(]) var(data))( +item(tt(syswrite) [ tt(-c) var(countvar) ] [ tt(-o) var(outfd) ] var(data))( The data (a single string of bytes) are written to the file descriptor var(outfd), or 1 if that is not given, using the tt(write) system call. Multiple write operations may be used if the first does not write all @@ -109,7 +110,7 @@ to the command, or 2 for an error on the write; no error message is printed in the last case, but the parameter tt(ERRNO) will reflect the error that occurred. ) -xitem(tt(zsystem flock [ -t) var(timeout) tt(] [ -f) var(var) tt(] [-er]) var(file)) +xitem(tt(zsystem flock) [ tt(-t) var(timeout) ] [ tt(-f) var(var) ] [tt(-er)] var(file)) item(tt(zsystem flock -u) var(fd_expr))( The builtin tt(zsystem)'s subcommand tt(flock) performs advisory file locking (via the manref(fcntl)(2) system call) over the entire contents @@ -126,7 +127,7 @@ the subshell exits. Status 0 is returned if the lock succeeds, else status 1. In the second form the file descriptor given by the arithmetic -expression tt(fd_expr) is closed, releasing a lock. The file descriptor +expression var(fd_expr) is closed, releasing a lock. The file descriptor can be queried by using the `tt(-f) var(var)' form during the lock; on a successful lock, the shell variable var(var) is set to the file descriptor used for locking. The lock will be released if the diff --git a/Doc/Zsh/mod_zftp.yo b/Doc/Zsh/mod_zftp.yo index de53cdbb3..fd997039e 100644 --- a/Doc/Zsh/mod_zftp.yo +++ b/Doc/Zsh/mod_zftp.yo @@ -128,15 +128,15 @@ item(tt(cdup))( Change the remote directory to the one higher in the directory tree. Note that tt(cd ..) will also work correctly on non-UNIX systems. ) -item(tt(dir) [ var(args...) ])( -Give a (verbose) listing of the remote directory. The var(args) are +item(tt(dir) [ var(arg) ... ])( +Give a (verbose) listing of the remote directory. The var(arg)s are passed directly to the server. The command's behaviour is implementation -dependent, but a UNIX server will typically interpret var(args) as +dependent, but a UNIX server will typically interpret var(arg)s as arguments to the tt(ls) command and with no arguments return the result of `tt(ls -l)'. The directory is listed to standard output. ) -item(tt(ls) [ var(args) ])( -Give a (short) listing of the remote directory. With no var(args), +item(tt(ls) [ var(arg) ... ])( +Give a (short) listing of the remote directory. With no var(arg), produces a raw list of the files in the directory, one per line. Otherwise, up to vagaries of the server implementation, behaves similar to tt(dir). @@ -164,8 +164,8 @@ item(tt(mode) [ tt(S) | tt(B) ])( Set the mode type to stream (tt(S)) or block (tt(B)). Stream mode is the default; block mode is not widely supported. ) -xitem(tt(remote) var(files...)) -item(tt(local) [ var(files...) ])( +xitem(tt(remote) var(file) ...) +item(tt(local) [ var(file) ... ])( Print the size and last modification time of the remote or local files. If there is more than one item on the list, the name of the file is printed first. The first number is the file size, the second @@ -185,15 +185,15 @@ arguments, in which case the information comes from examining file descriptor zero. This is the same file as seen by a tt(put) command with no further redirection. ) -item(tt(get) var(file) [...])( +item(tt(get) var(file) ...)( Retrieve all var(file)s from the server, concatenating them and sending them to standard output. ) -item(tt(put) var(file) [...])( +item(tt(put) var(file) ...)( For each var(file), read a file from standard input and send that to the remote host with the given name. ) -item(tt(append) var(file) [...])( +item(tt(append) var(file) ...)( As tt(put), but if the remote var(file) already exists, data is appended to it instead of overwriting it. ) @@ -206,7 +206,7 @@ useful for appending to an incomplete local file. However, note that this ability is not universally supported by servers (and is not quite the behaviour specified by the standard). ) -item(tt(delete) var(file) [...])( +item(tt(delete) var(file) ...)( Delete the list of files on the server. ) item(tt(mkdir) var(directory))( @@ -218,11 +218,11 @@ Delete the directory var(directory) on the server. item(tt(rename) var(old-name) var(new-name))( Rename file var(old-name) to var(new-name) on the server. ) -item(tt(site) var(args...))( +item(tt(site) var(arg) ...)( Send a host-specific command to the server. You will probably only need this if instructed by the server to use it. ) -item(tt(quote) var(args...))( +item(tt(quote) var(arg) ...)( Send the raw FTP command sequence to the server. You should be familiar with the FTP command set as defined in RFC959 before doing this. Useful commands may include tt(STAT) and tt(HELP). Note also diff --git a/Doc/Zsh/mod_zpty.yo b/Doc/Zsh/mod_zpty.yo index de471153e..340f98314 100644 --- a/Doc/Zsh/mod_zpty.yo +++ b/Doc/Zsh/mod_zpty.yo @@ -5,7 +5,7 @@ The tt(zsh/zpty) module offers one builtin: startitem() findex(zpty) -item(tt(zpty) [ tt(-e) ] [ tt(-b) ] var(name) [ var(arg ...) ])( +item(tt(zpty) [ tt(-e) ] [ tt(-b) ] var(name) [ var(arg) ... ])( The arguments following var(name) are concatenated with spaces between, then executed as a command, as if passed to the tt(eval) builtin. The command runs under a newly assigned pseudo-terminal; this is useful for @@ -19,18 +19,18 @@ characters are echoed. With the tt(-b) option, input to and output from the pseudo-terminal are made non-blocking. ) -item(tt(zpty) tt(-d) [ var(names) ... ])( +item(tt(zpty) tt(-d) [ var(name) ... ])( The second form, with the tt(-d) option, is used to delete commands previously started, by supplying a list of their var(name)s. If no -var(names) are given, all commands are deleted. Deleting a command causes +var(name) is given, all commands are deleted. Deleting a command causes the HUP signal to be sent to the corresponding process. ) -item(tt(zpty) tt(-w) [ tt(-n) ] var(name) [ var(strings ...) ])( +item(tt(zpty) tt(-w) [ tt(-n) ] var(name) [ var(string) ... ])( The tt(-w) option can be used to send the to command var(name) the given -var(strings) as input (separated by spaces). If the tt(-n) option is +var(string)s as input (separated by spaces). If the tt(-n) option is em(not) given, a newline is added at the end. -If no var(strings) are provided, the standard input is copied to the +If no var(string) is provided, the standard input is copied to the pseudo-terminal; this may stop before copying the full input if the pseudo-terminal is non-blocking. diff --git a/Doc/Zsh/mod_zselect.yo b/Doc/Zsh/mod_zselect.yo index a374b2c34..e0651571e 100644 --- a/Doc/Zsh/mod_zselect.yo +++ b/Doc/Zsh/mod_zselect.yo @@ -7,7 +7,7 @@ startitem() findex(zselect) cindex(select, system call) cindex(file descriptors, waiting for) -item(tt(zselect) [ tt(-rwe) tt(-t) var(timeout) tt(-a) var(array) ] [ var(fd) ... ])( +item(tt(zselect) [ tt(-rwe) ] [ tt(-t) var(timeout) ] [ tt(-a) var(array) ] [ tt(-A) var(assoc) ] [ var(fd) ... ])( The tt(zselect) builtin is a front-end to the `select' system call, which blocks until a file descriptor is ready for reading or writing, or has an error condition, with an optional timeout. If this is not available on @@ -39,7 +39,7 @@ zselect with no file descriptors and a non-zero timeout for use as a finer-grained replacement for `sleep'; note, however, the return status is always 1 for a timeout. -The option `tt(-a) var(array)' indicates that tt(array) should be set to +The option `tt(-a) var(array)' indicates that var(array) should be set to indicate the file descriptor+LPAR()s+RPAR() which are ready. If the option is not given, the array tt(reply) will be used for this purpose. The array will @@ -52,7 +52,7 @@ might return immediately with status 0 and tt($reply) containing `tt(-r 0 -w operations. The option `tt(-A) var(assoc)' indicates that the associative array -tt(assoc) should be set to indicate the file descriptor+LPAR()s+LPAR() +var(assoc) should be set to indicate the file descriptor+LPAR()s+RPAR() which are ready. This option overrides the option tt(-a), nor will tt(reply) be modified. The keys of tt(assoc) are the file descriptors, and the corresponding values are any of the characters `tt(rwe)' to indicate diff --git a/Doc/Zsh/mod_zutil.yo b/Doc/Zsh/mod_zutil.yo index 7e8911113..fd6f2f384 100644 --- a/Doc/Zsh/mod_zutil.yo +++ b/Doc/Zsh/mod_zutil.yo @@ -8,11 +8,11 @@ The tt(zsh/zutil) module only adds some builtins: startitem() findex(zstyle) xitem(tt(zstyle) [ tt(-L) [ var(pattern) [ var(style) ] ] ]) -xitem(tt(zstyle) [ tt(-e) | tt(-) | tt(-)tt(-) ] var(pattern) var(style) var(strings) ...) -xitem(tt(zstyle -d) [ var(pattern) [ var(styles) ... ] ]) +xitem(tt(zstyle) [ tt(-e) | tt(-) | tt(-)tt(-) ] var(pattern) var(style) var(string) ...) +xitem(tt(zstyle -d) [ var(pattern) [ var(style) ... ] ]) xitem(tt(zstyle -g) var(name) [ var(pattern) [ var(style) ] ]) -xitem(tt(zstyle -abs) var(context) var(style) var(name) [ var(sep) ]) -xitem(tt(zstyle -Tt) var(context) var(style) [ var(strings) ...]) +xitem(tt(zstyle -){tt(a)|tt(b)|tt(s)} var(context) var(style) var(name) [ var(sep) ]) +xitem(tt(zstyle -){tt(T)|tt(t)} var(context) var(style) [ var(string) ... ]) item(tt(zstyle -m) var(context) var(style) var(pattern))( This builtin command is used to define and lookup styles. Styles are pairs of names and values, where the values consist of any number of @@ -40,16 +40,16 @@ against the string supplied as the pattern for the context; note that this means, for example, `tt(zstyle -L ":completion:*")' will match any supplied pattern beginning `tt(:completion:)', not just tt(":completion:*"): use tt(":completion:\*") to match that. -The optional second argument limits the output to a specific style (not a +The optional second argument limits the output to a specific var(style) (not a pattern). tt(-L) is not compatible with any other options. The other forms are the following: startitem() -item(tt(zstyle) [ tt(-) | tt(-)tt(-) | tt(-e) ] var(pattern) var(style) var(strings) ...)( +item(tt(zstyle) [ tt(-) | tt(-)tt(-) | tt(-e) ] var(pattern) var(style) var(string) ...)( vindex(reply, use of) -Defines the given var(style) for the var(pattern) with the var(strings) as -the value. If the tt(-e) option is given, the var(strings) will be +Defines the given var(style) for the var(pattern) with the var(string)s as +the value. If the tt(-e) option is given, the var(string)s will be concatenated (separated by spaces) and the resulting string will be evaluated (in the same way as it is done by the tt(eval) builtin command) when the style is looked up. In this case the parameter @@ -58,16 +58,16 @@ evaluation. Before evaluating the value, tt(reply) is unset, and if it is still unset after the evaluation, the style is treated as if it were not set. ) -item(tt(zstyle -d) [ var(pattern) [ var(styles) ... ] ])( +item(tt(zstyle -d) [ var(pattern) [ var(style) ... ] ])( Delete style definitions. Without arguments all definitions are deleted, with a var(pattern) all definitions for that pattern are deleted and if -any var(styles) are given, then only those styles are deleted for the +any var(style)s are given, then only those styles are deleted for the var(pattern). ) item(tt(zstyle -g) var(name) [ var(pattern) [ var(style) ] ])( Retrieve a style definition. The var(name) is used as the name of an array in which the results are stored. Without -any further arguments, all var(patterns) defined are returned. With a +any further arguments, all patterns defined are returned. With a var(pattern) the styles defined for that pattern are returned and with both a var(pattern) and a var(style), the value strings of that combination is returned. @@ -93,14 +93,14 @@ The value is stored in var(name) as an array. If var(name) is declared as an associative array, the first, third, etc. strings are used as the keys and the other strings are used as the values. ) -xitem(tt(zstyle -t) var(context) var(style) [ var(strings) ...]) -item(tt(zstyle -T) var(context) var(style) [ var(strings) ...])( +xitem(tt(zstyle -t) var(context) var(style) [ var(string) ... ]) +item(tt(zstyle -T) var(context) var(style) [ var(string) ... ])( Test the value of a style, i.e. the tt(-t) option only returns a status -(sets tt($?)). Without any var(strings) the return status is zero if the +(sets tt($?)). Without any var(string) the return status is zero if the style is defined for at least one matching pattern, has only one string in its value, and that is equal to one of `tt(true)', `tt(yes)', `tt(on)' or -`tt(1)'. If any var(strings) are given the status is zero if and only if -at least one of the var(strings) is equal to at least one of the strings +`tt(1)'. If any var(string)s are given the status is zero if and only if +at least one of the var(string)s is equal to at least one of the strings in the value. If the style is defined but doesn't match, the return status is tt(1). If the style is not defined, the status is tt(2). @@ -115,12 +115,12 @@ var(pattern) matches at least one of the strings in the value. enditem() ) findex(zformat) -xitem(tt(zformat -f) var(param) var(format) var(specs) ...) -item(tt(zformat -a) var(array) var(sep) var(specs) ...)( +xitem(tt(zformat -f) var(param) var(format) var(spec) ...) +item(tt(zformat -a) var(array) var(sep) var(spec) ...)( This builtin provides two different forms of formatting. The first form is selected with the tt(-f) option. In this case the var(format) string will be modified by replacing sequences starting with a percent -sign in it with strings from the var(specs). Each var(spec) should be +sign in it with strings from the var(spec)s. Each var(spec) should be of the form `var(char)tt(:)var(string)' which will cause every appearance of the sequence `tt(%)var(char)' in var(format) to be replaced by the var(string). The `tt(%)' sequence may also contain optional @@ -132,7 +132,7 @@ width makes the result be padded with spaces to the right if the var(string) is shorter than the requested width. Padding to the left can be achieved by giving a negative minimum field width. If a maximum field width is specified, the var(string) will be truncated after that -many characters. After all `tt(%)' sequences for the given var(specs) +many characters. After all `tt(%)' sequences for the given var(spec)s have been processed, the resulting string is stored in the parameter var(param). @@ -162,7 +162,7 @@ specifier tt(c) is 3, agreeing with the digit argument to the ternary expression. The second form, using the tt(-a) option, can be used for aligning -strings. Here, the var(specs) are of the form +strings. Here, the var(spec)s are of the form `var(left)tt(:)var(right)' where `var(left)' and `var(right)' are arbitrary strings. These strings are modified by replacing the colons by the var(sep) string and padding the var(left) strings with spaces @@ -179,7 +179,7 @@ item(tt(zregexparse))( This implements some internals of the tt(_regex_arguments) function. ) findex(zparseopts) -item(tt(zparseopts) [ tt(-D) ] [ tt(-K) ] [ tt(-M) ] [ tt(-E) ] [ tt(-a) var(array) ] [ tt(-A) var(assoc) ] var(specs))( +item(tt(zparseopts) [ tt(-DKME) ] [ tt(-a) var(array) ] [ tt(-A) var(assoc) ] var(spec) ...)( This builtin simplifies the parsing of options in positional parameters, i.e. the set of arguments given by tt($*). Each var(spec) describes one option and must be of the form `var(opt)[tt(=)var(array)]'. If an option @@ -191,7 +191,7 @@ Note that it is an error to give any var(spec) without an `tt(=)var(array)' unless one of the tt(-a) or tt(-A) options is used. Unless the tt(-E) option is given, parsing stops at the first string -that isn't described by one of the var(specs). Even with tt(-E), +that isn't described by one of the var(spec)s. Even with tt(-E), parsing always stops at a positional parameter equal to `tt(-)' or `tt(-)tt(-)'. @@ -247,14 +247,14 @@ as the values. item(tt(-D))( If this option is given, all options found are removed from the positional parameters of the calling shell or shell function, up to but not including -any not described by the var(specs). This is similar to using the tt(shift) +any not described by the var(spec)s. This is similar to using the tt(shift) builtin. ) item(tt(-K))( With this option, the arrays specified with the tt(-a) option and with the -`tt(=)var(array)' forms are kept unchanged when none of the var(specs) for +`tt(=)var(array)' forms are kept unchanged when none of the var(spec)s for them is used. Otherwise the entire array is replaced when any of the -var(specs) is used. Individual elements of associative arrays specified +var(spec)s is used. Individual elements of associative arrays specified with the tt(-A) option are preserved by tt(-K). This allows assignment of default values to arrays before calling tt(zparseopts). ) diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 20d9fc2a8..032423def 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -792,7 +792,7 @@ Save each command's beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file. The format of this prefixed data is: -`tt(:) var(<beginning time>)tt(:)var(<elapsed seconds>)tt(;)var(<command>)'. +`tt(: )var(<beginning time>)tt(:)var(<elapsed seconds>)tt(;)var(<command>)'. ) pindex(HIST_ALLOW_CLOBBER) pindex(NO_HIST_ALLOW_CLOBBER) @@ -932,7 +932,7 @@ pindex(HISTSAVEBYCOPY) pindex(NOHISTSAVEBYCOPY) item(tt(HIST_SAVE_BY_COPY) <D>)( When the history file is re-written, we normally write out a copy of -the file named $HISTFILE.new and then rename it over the old one. +the file named tt($HISTFILE.new) and then rename it over the old one. However, if this option is unset, we instead truncate the old history file and write out the new version in-place. If one of the history-appending options is enabled, this option only has an effect @@ -974,7 +974,7 @@ are added to the tt($HISTFILE) incrementally (as soon as they are entered), rather than waiting until the shell exits. The file will still be periodically re-written to trim it when the number of lines grows 20% beyond the value specified by -tt($SAVEHIST) (see also the HIST_SAVE_BY_COPY option). +tt($SAVEHIST) (see also the tt(HIST_SAVE_BY_COPY) option). ) pindex(INC_APPEND_HISTORY_TIME) pindex(NO_INC_APPEND_HISTORY_TIME) @@ -1037,7 +1037,7 @@ pindex(NO_GLOBAL_EXPORT) pindex(GLOBALEXPORT) pindex(NOGLOBALEXPORT) cindex(environment, and local parameters) -item(tt(GLOBAL_EXPORT) (tt(<Z>)))( +item(tt(GLOBAL_EXPORT) <Z>)( If this option is set, passing the tt(-x) flag to the builtins tt(declare), tt(float), tt(integer), tt(readonly) and tt(typeset) (but not tt(local)) will also set the tt(-g) flag; hence parameters exported to @@ -1483,8 +1483,8 @@ wrap to the next line when a partial line is present (note that this is only successful if your terminal has automatic margins, which is typical). When a partial line is preserved, by default you will see an inverse+bold -character at the end of the partial line: a "%" for a normal user or -a "#" for root. If set, the shell parameter tt(PROMPT_EOL_MARK) can be +character at the end of the partial line: a `tt(%)' for a normal user or +a `tt(#)' for root. If set, the shell parameter tt(PROMPT_EOL_MARK) can be used to customize how the end of partial lines are shown. NOTE: if the tt(PROMPT_CR) option is not set, enabling this option will @@ -1548,7 +1548,7 @@ cindex(operator precedence) item(tt(C_PRECEDENCES))( This alters the precedence of arithmetic operators to be more like C and other programming languages; -ifnzman(Arithmetic Evaluation)\ +ifnzman(noderef(Arithmetic Evaluation))\ ifzman(the section ARITHMETIC EVALUATION in zmanref(zshmisc)) has an explicit list. ) @@ -1856,8 +1856,8 @@ pindex(NOCSHJUNKIELOOPS) cindex(csh, loop style) cindex(loop style, csh) item(tt(CSH_JUNKIE_LOOPS) <C>)( -Allow loop bodies to take the form `var(list); tt(end)' instead of -`tt(do) var(list); tt(done)'. +Allow loop bodies to take the form `var(list)tt(; end)' instead of +`tt(do )var(list)tt(; done)'. ) pindex(CSH_JUNKIE_QUOTES) pindex(NO_CSH_JUNKIE_QUOTES) @@ -2113,7 +2113,7 @@ pindex(NOSHFILEEXPANSION) cindex(sh, expansion style) cindex(expansion style, sh) item(tt(SH_FILE_EXPANSION) <K> <S>)( -Perform filename expansion (e.g., ~ expansion) em(before) +Perform filename expansion (e.g., tt(~) expansion) em(before) parameter expansion, command substitution, arithmetic expansion and brace expansion. If this option is unset, it is performed em(after) diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 9d06b6af6..eb3eb367e 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -111,7 +111,7 @@ indent(tt(typeset -A) var(name)) When var(name) refers to an associative array, the list in an assignment is interpreted as alternating keys and values: ifzman() -indent(set -A var(name) var(key) var(value) ...) +indent(tt(set -A) var(name) var(key) var(value) ...) indent(var(name)tt(=LPAR())var(key) var(value) ...tt(RPAR())) Every var(key) must have a var(value) in this case. Note that this @@ -282,14 +282,14 @@ pattern and the result is the first matching array element, substring or word (if the parameter is an array, if it is a scalar, or if it is a scalar and the `tt(w)' flag is given, respectively). The subscript used is the number of the matching element, so that pairs of subscripts such as -`tt($foo[(r))var(??)tt(,3])' and `tt($foo[(r))var(??)tt(,(r)f*])' are +`tt($foo[(r)??,3])' and `tt($foo[(r)??,(r)f*])' are possible if the parameter is not an associative array. If the parameter is an associative array, only the value part of each pair is compared to the pattern, and the result is that value. If a search through an ordinary array failed, the search sets the subscript to one past the end of the array, and hence -tt(${array[(r)pattern]}) will substitute the empty string. Thus the +tt(${array[(r))var(pattern)tt(]}) will substitute the empty string. Thus the success of a search can be tested by using the tt((i)) flag, for example (assuming the option tt(KSH_ARRAYS) is not in effect): @@ -642,6 +642,9 @@ privileges, you may change the effective group ID of the shell process by assigning to this parameter. Also (assuming sufficient privileges), you may start a single command with a different effective group ID by `tt(LPAR()EGID=)var(gid)tt(; command+RPAR())' + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(EUID) item(tt(EUID) <S>)( @@ -650,6 +653,9 @@ privileges, you may change the effective user ID of the shell process by assigning to this parameter. Also (assuming sufficient privileges), you may start a single command with a different effective user ID by `tt(LPAR()EUID=)var(uid)tt(; command+RPAR())' + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(ERRNO) item(tt(ERRNO) <S>)( @@ -666,6 +672,9 @@ you may change the group ID of the shell process by assigning to this parameter. Also (assuming sufficient privileges), you may start a single command under a different group ID by `tt(LPAR()GID=)var(gid)tt(; command+RPAR())' + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(HISTCMD) item(tt(HISTCMD))( @@ -801,6 +810,9 @@ you may change the user ID of the shell by assigning to this parameter. Also (assuming sufficient privileges), you may start a single command under a different user ID by `tt(LPAR()UID=)var(uid)tt(; command+RPAR())' + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(USERNAME) item(tt(USERNAME) <S>)( @@ -1075,8 +1087,8 @@ example, if the value is `tt(fc *)' then commands that invoke the interactive history editor are never written to the history file. Note that tt(HISTORY_IGNORE) defines a single pattern: to -specify alternatives use the `tt(+LPAR()first|second|...+RPAR())' -syntax. +specify alternatives use the +`tt(LPAR())var(first)tt(|)var(second)tt(|)var(...)tt(RPAR())' syntax. Compare the tt(HIST_NO_STORE) option or the tt(zshaddhistory) hook, either of which would prevent such commands from being added to the @@ -1098,6 +1110,9 @@ The maximum number of events stored in the internal history list. If you use the tt(HIST_EXPIRE_DUPS_FIRST) option, setting this value larger than the tt(SAVEHIST) size will give you the difference as a cushion for saving duplicated history events. + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(HOME) item(tt(HOME) <S>)( @@ -1392,6 +1407,9 @@ It is expanded in the same way as tt(PS2). vindex(SAVEHIST) item(tt(SAVEHIST))( The maximum number of history events to save in the history file. + +If this is made local, it is not implicitly set to 0, but may be +explicitly set locally. ) vindex(SPROMPT) item(tt(SPROMPT) <S>)( @@ -1450,7 +1468,7 @@ sitem(tt(%W))(Number of times the process was swapped.) sitem(tt(%X))(The average amount in (shared) text space used in kilobytes.) sitem(tt(%D))(The average amount in (unshared) data/stack space used in kilobytes.) -sitem(tt(%K))(The total space used (%X+%D) in kilobytes.) +sitem(tt(%K))(The total space used (tt(%X)PLUS()tt(%D)) in kilobytes.) sitem(tt(%M))(The maximum memory the process had in use at any time in megabytes.) sitem(tt(%F))(The number of major page faults (page needed to be brought @@ -1675,7 +1693,7 @@ ifzman(zmanref(zshcompsys))\ ifnzman(noderef(Completion System)). ) vindex(ZLE_RPROMPT_INDENT) -item(tt(ZLE_RPROMPT_INDENT <S>))( +item(tt(ZLE_RPROMPT_INDENT) <S>)( If set, used to give the indentation between the right hand side of the right prompt in the line editor as given by tt(RPS1) or tt(RPROMPT) and the right hand side of the screen. If not set, the value 1 is used. diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo index 8d231f40f..35fa773fd 100644 --- a/Doc/Zsh/redirect.yo +++ b/Doc/Zsh/redirect.yo @@ -155,7 +155,7 @@ ifnzman(noderef(Simple Commands & Pipelines)) is a shorthand for `tt(2>&1 |)'. The various forms of process substitution, `tt(<LPAR())var(list)tt(RPAR())', -and `tt(=LPAR())var(list)(RPAR())' for input and +and `tt(=LPAR())var(list)tt(RPAR())' for input and `tt(>LPAR())var(list)tt(RPAR())' for output, are often used together with redirection. For example, if var(word) in an output redirection is of the form `tt(>LPAR())var(list)tt(RPAR())' then the output is piped to the @@ -176,7 +176,7 @@ is guaranteed to be at least 10 and set the parameter named by the identifier to the file descriptor opened. No whitespace is allowed between the closing brace and the redirection character. For example: -indent(... {myfd}>&1) +indent(... tt({myfd}>&1)) This opens a new file descriptor that is a duplicate of file descriptor 1 and sets the parameter tt(myfd) to the number of the file descriptor, @@ -275,9 +275,10 @@ If the tt(MULTIOS) option is em(un)set, each redirection replaces the previous redirection for that file descriptor. However, all files redirected to are actually opened, so -example(echo foo > bar > baz) +example(echo Hello > bar > baz) -when tt(MULTIOS) is unset will truncate bar, and write `tt(foo)' into baz. +when tt(MULTIOS) is unset will truncate `tt(bar)', and write `tt(Hello)' +into `tt(baz)'. There is a problem when an output multio is attached to an external program. A simple example shows this: diff --git a/Doc/Zsh/tcpsys.yo b/Doc/Zsh/tcpsys.yo index 406785997..f9b403c5b 100644 --- a/Doc/Zsh/tcpsys.yo +++ b/Doc/Zsh/tcpsys.yo @@ -7,10 +7,10 @@ sect(Description) A module tt(zsh/net/tcp) is provided to provide network I/O over TCP/IP from within the shell; see its description in ifzman(\ -zmanref(zshmodules) +zmanref(zshmodules)\ )\ ifnzman(\ -noderef(Zsh Modules) +noderef(Zsh Modules)\ ). This manual page describes a function suite based on the module. If the module is installed, the functions are usually installed at the same time, in which case they will be available for @@ -19,10 +19,10 @@ tt(zsh/net/tcp) module, the tt(zsh/zselect) module is used to implement timeouts on read operations. For troubleshooting tips, consult the corresponding advice for the tt(zftp) functions described in ifzman(\ -zmanref(zshzftpsys) +zmanref(zshzftpsys)\ )\ ifnzman(\ -noderef(Zftp Function System) +noderef(Zftp Function System)\ ). There are functions corresponding to the basic I/O operations open, close, @@ -53,9 +53,9 @@ subsect(Basic I/O) startitem() findex(tcp_open) -xitem(tt(tcp_open [-qz]) var(host port) tt([) var(sess) tt(])) -xitem(tt(tcp_open [-qz] [ -s) var(sess) tt(| -l) var(sess)tt(,... ] ... )) -item(tt(tcp_open [-qz] [-a) var(fd) tt(| -f) var(fd) tt(] [) var(sess) tt(]))( +xitem(tt(tcp_open) [ tt(-qz) ] var(host port) [ var(sess) ]) +xitem(tt(tcp_open) [ tt(-qz) ] [ tt(-s) var(sess) | tt(-l) var(sess)[tt(,)...] ] ... ) +item(tt(tcp_open) [ tt(-qz) ] [ tt(-a) var(fd) | tt(-f) var(fd) ] [ var(sess) ])( Open a new session. In the first and simplest form, open a TCP connection to host var(host) at port var(port); numeric and symbolic forms are understood for both. @@ -102,7 +102,7 @@ will not print informational messages, although it will in any case exit with an appropriate status. If the line editor (zle) is in use, which is typically the case if the -shell is interactive, tt(tcp_open) installs a handler inside tt(zle) which +shell is interactive, tt(tcp_open) installs a handler inside zle which will check for new data at the same time as it checks for keyboard input. This is convenient as the shell consumes no CPU time while waiting; the test is performed by the operating system. Giving the option tt(-z) to @@ -123,7 +123,7 @@ The function tt(tcp_on_open), if defined, is called when a session is opened. See the description below. ) findex(tcp_close) -item(tt(tcp_close [-qn] [ -a | -l) var(sess)tt(,... |) var(sess) tt(... ]))( +item(tt(tcp_close) [ tt(-qn) ] [ tt(-a) | tt(-l) var(sess)[tt(,)...] | var(sess) ... ])( Close the named sessions, or the current session if none is given, or all open sessions if tt(-a) is given. The options tt(-l) and tt(-s) are both handled for consistency with tt(tcp_open), although the latter is @@ -142,8 +142,9 @@ session. If the option tt(-q) is given, no informational messages will be printed. ) findex(tcp_read) -xitem(tt(tcp_read [-bdq] [ -t) var(TO) tt(] [ -T) var(TO) tt(])) -item( tt([ -a | -u) var(fd) tt(... | -l) var(sess)tt(,... | -s) var(sess) tt(...]))( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(tcp_read )[ tt(-bdq) ] [ tt(-t) var(TO) ] [ tt(-T) var(TO) ]) +item(SPACES()[ tt(-a) | tt(-u) var(fd)[tt(,)...] | tt(-l) var(sess)[tt(,)...] | tt(-s) var(sess) ... ])( Perform a read operation on the current session, or on a list of sessions if any are given with tt(-u), tt(-l) or tt(-s), or all open sessions if the option tt(-a) is given. Any of the tt(-u), tt(-l) or @@ -189,8 +190,8 @@ non-zero return status indicates some error condition. See tt(tcp_log) for how to control where data is sent by tt(tcp_read). ) findex(tcp_send) -xitem(tt(tcp_send [-cnq] [ -s) var(sess) tt(| -l) var(sess)tt(,... ]) var(data) tt(...)) -item(tt(tcp_send [-cnq] -a) var(data) tt(...))( +xitem(tt(tcp_send) [ tt(-cnq) ] [ tt(-s) var(sess) | tt(-l) var(sess)[tt(,)...] ] var(data) ...) +item(tt(tcp_send) [ tt(-cnq) ] tt(-a) var(data) ...)( Send the supplied data strings to all the specified sessions in turn. The underlying operation differs little from a `tt(print -r)' to the session's file descriptor, although it attempts to prevent the shell from dying owing @@ -220,9 +221,9 @@ subsect(Session Management) startitem() findex(tcp_alias) -xitem(tt(tcp_alias [-q]) var(alias)tt(=)var(sess) tt(...)) -xitem(tt(tcp_alias [-q] [) var(alias) tt(] ...)) -item(tt(tcp_alias -d [-q]) var(alias) tt(...))( +xitem(tt(tcp_alias) [ tt(-q) ] var(alias)tt(=)var(sess) ...) +xitem(tt(tcp_alias) [ tt(-q) ] [ var(alias) ... ]) +item(tt(tcp_alias) tt(-d) [ tt(-q) ] var(alias) ...)( This function is not particularly well tested. The first form creates an alias for a session name; var(alias) can then be @@ -238,14 +239,14 @@ The option tt(-q) suppresses an inconsistently chosen subset of error messages. ) findex(tcp_log) -item(tt(tcp_log [-asc] [ -n | -N ] [) var(logfile) tt(]))( +item(tt(tcp_log) [ tt(-asc) ] [ tt(-n) | tt(-N) ] [ var(logfile) ])( With an argument var(logfile), all future input from tt(tcp_read) will be logged to the named file. Unless tt(-a) (append) is given, this file will first be truncated or created empty. With no arguments, show the current status of logging. With the option tt(-s), per-session logging is enabled. Input from -tt(tcp_read) is output to the file var(logfile).var(sess). As the +tt(tcp_read) is output to the file var(logfile)tt(.)var(sess). As the session is automatically discriminated by the filename, the contents are raw (no tt($TCP_PROMPT)). The option tt(-a) applies as above. Per-session logging and logging of all data in one file are not mutually @@ -265,7 +266,7 @@ item(tt(tcp_rename) var(old) var(new))( Rename session var(old) to session var(new). The old name becomes invalid. ) findex(tcp_sess) -item(tt(tcp_sess [) var(sess) tt([) var(command) tt(... ] ]))( +item(tt(tcp_sess) [ var(sess) [ var(command) [ var(arg) ... ] ] ])( With no arguments, list all the open sessions and associated file descriptors. The current session is marked with a star. For use in functions, direct access to the parameters tt($tcp_by_name), tt($tcp_by_fd) @@ -275,9 +276,9 @@ With a var(sess) argument, set the current session to var(sess). This is equivalent to changing tt($TCP_SESS) directly. With additional arguments, temporarily set the current session while -executing the string tt(command ...). The first argument is re-evaluated -so as to expand aliases etc., but the remaining arguments are passed -through as the appear to tt(tcp_sess). The original session is restored +executing `var(command) var(arg) ...'. var(command) is re-evaluated +so as to expand aliases etc., but the remaining var(arg)s are passed +through as that appear to tt(tcp_sess). The original session is restored when tt(tcp_sess) exits. ) enditem() @@ -286,7 +287,7 @@ subsect(Advanced I/O) startitem() findex(tcp_command) -item(tt(tcp_command) var(send-options) tt(...) var(send-arguments) tt(...))( +item(tt(tcp_command) var(send-option) ... var(send-argument) ...)( This is a convenient front-end to tt(tcp_send). All arguments are passed to tt(tcp_send), then the function pauses waiting for data. While data is arriving at least every tt($TCP_TIMEOUT) (default 0.3) seconds, data is @@ -299,8 +300,9 @@ programme or function it is generally better to handle reading data by a more explicit method. ) findex(tcp_expect) -xitem(tt(tcp_expect [ -q ] [ -p ) var(var) tt( | -P ) var(var) tt(] [ -t ) var(to) tt(| -T) var(TO)tt(])) -item(tt( [ -a | -s) var(sess) tt(... | -l) var(sess)tt(,... ]) var(pattern) ...)( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(tcp_expect )[ tt(-q) ] [ tt(-p) var(var) | tt(-P) var(var) ] [ tt(-t) var(TO) | tt(-T) var(TO) ]) +item(SPACES()[ tt(-a) | tt(-s) var(sess) | tt(-l) var(sess)[tt(,)...] ] var(pattern) ...)( Wait for input matching any of the given var(pattern)s from any of the specified sessions. Input is ignored until an input line matches one of the given patterns; at this point status zero is returned, the matching @@ -371,8 +373,8 @@ The command is run in the background, so tt(tcp_proxy) can then accept new connections. It continues to accept new connections until interrupted. ) findex(tcp_spam) -item(tt(tcp_spam [-ertv] [ -a | -s ) var(sess) tt(| -l) var(sess)tt(,... ]) var(cmd) tt(...))( -Execute `var(cmd) tt(...)' for each session in turn. Note this executes +item(tt(tcp_spam) [ tt(-ertv) ] [ tt(-a) | tt(-s) var(sess) | tt(-l) var(sess)[tt(,)...] ] var(cmd) [ var(arg) ... ])( +Execute `var(cmd) [ var(arg) ... ]' for each session in turn. Note this executes the command and arguments; it does not send the command line as data unless the tt(-t) (transmit) option is given. @@ -389,19 +391,19 @@ tt($tcp_spam_list) array or on the command line are spammed in the order given. The tt(-r) flag reverses the order however it was arrived it. The tt(-v) flag specifies that a tt($TCP_PROMPT) will be output before each -session. This is output after any modification to TCP_SESS by the +session. This is output after any modification to tt(TCP_SESS) by the user-defined tt(tcp_on_spam) function described below. (Obviously that function is able to generate its own output.) -If the option tt(-e) is present, the line given as var(cmd ...) is executed +If the option tt(-e) is present, the line given as `var(cmd) [ var(arg) ... ]' is executed using tt(eval), otherwise it is executed without any further processing. ) findex(tcp_talk) item(tt(tcp_talk))( This is a fairly simple-minded attempt to force input to the line editor to -go straight to the default TCP_SESSION. +go straight to the default tt(TCP_SESS). -An escape string, tt($TCP_TALK_ESCAPE), default `:', is used to allow +An escape string, tt($TCP_TALK_ESCAPE), default `tt(:)', is used to allow access to normal shell operation. If it is on its own at the start of the line, or followed only by whitespace, the line editor returns to normal operation. Otherwise, the string and any following whitespace are skipped @@ -507,7 +509,7 @@ This is called after a session has been renamed with the three arguments old session name, file descriptor, new session name. ) findex(tcp_on_spam) -item(tt(tcp_on_spam) var(sess) var(command) tt(...))( +item(tt(tcp_on_spam) var(sess) var(command ...))( This is called once for each session spammed, just em(before) a command is executed for a session by tt(tcp_spam). The arguments are the session name followed by the command list to be executed. If tt(tcp_spam) was called @@ -554,7 +556,7 @@ tt(tcp_on_read)) to tell if is being called when the shell is otherwise idle at the editor prompt. ) findex(tcp_output) -item(tt(tcp_output [ -q ] -P) var(prompt) tt(-F) var(fd) tt(-S) var(sess))( +item(tt(tcp_output) [ tt(-q) ] tt(-P) var(prompt) tt(-F) var(fd) tt(-S) var(sess))( This function is used for both logging and handling output to standard output, from within tt(tcp_read) and (if tt($TCP_OUTPUT) is set) tt(tcp_send). @@ -786,7 +788,7 @@ sect(TCP Examples) Here is a trivial example using a remote calculator. -TO create a calculator server on port 7337 (see the tt(dc) manual page for +To create a calculator server on port 7337 (see the tt(dc) manual page for quite how infuriating the underlying command is): example(tcp_proxy 7337 dc) diff --git a/Doc/Zsh/zftpsys.yo b/Doc/Zsh/zftpsys.yo index 56308302c..00062e43d 100644 --- a/Doc/Zsh/zftpsys.yo +++ b/Doc/Zsh/zftpsys.yo @@ -75,10 +75,10 @@ are treated literally (a single `tt(-)' is treated as an argument). subsect(Opening a connection) startitem() findex(zfparams) -item(tt(zfparams [ var(host) [ var(user) [ var(password) ... ] ] ]))( +item(tt(zfparams) [ var(host) [ var(user) [ var(password) ... ] ] ])( Set or show the parameters for a future tt(zfopen) with no arguments. If no arguments are given, the current parameters are displayed (the password -will be shown as a line of asterisks). If a host is given, and either the +will be shown as a line of asterisks). If a var(host) is given, and either the var(user) or var(password) is not, they will be prompted for; also, any parameter given as `tt(?)' will be prompted for, and if the `tt(?)' is followed by a string, that will be used as the prompt. As tt(zfopen) calls @@ -90,7 +90,7 @@ also cause the memory of the last directory (and so on) on the other host to be deleted. ) findex(zfopen) -item(tt(zfopen [ -1 ] [ var(host) [ var(user) [ var(password) [ var(account) ] ] ] ]))( +item(tt(zfopen) [ tt(-1) ] [ var(host) [ var(user) [ var(password) [ var(account) ] ] ] ])( If var(host) is present, open a connection to that host under username var(user) with password var(password) (and, on the rare occasions when it is necessary, account var(account)). If a necessary parameter is missing or @@ -119,7 +119,7 @@ to trigger recognition of the var(path). Note prefixes other than slash beyond var(host) are significant in var(path). ) findex(zfanon) -item(tt(zfanon [ -1 ] var(host)))( +item(tt(zfanon) [ tt(-1) ] var(host))( Open a connection var(host) for anonymous FTP. The username used is `tt(anonymous)'. The password (which will be reported the first time) is generated as var(user)tt(@)var(host); this is then stored in the shell @@ -131,9 +131,9 @@ enditem() subsect(Directory management) startitem() findex(zfcd) -xitem(tt(zfcd [ var(dir) ])) +xitem(tt(zfcd) [ var(dir) ]) xitem(tt(zfcd -)) -item(tt(zfcd var(old) var(new)))( +item(tt(zfcd) var(old) var(new))( Change the current directory on the remote server: this is implemented to have many of the features of the shell builtin tt(cd). @@ -168,7 +168,7 @@ For example, if the current local directory is tt(~/foo/bar), then tt(zfhere) performs the effect of `tt(zfcd ~/foo/bar)'. ) findex(zfdir) -item(tt(zfdir [ -rfd ] [ - ] [ var(dir-options) ] [ var(dir) ]))( +item(tt(zfdir) [ tt(-rfd) ] [ tt(-) ] [ var(dir-options) ] [ var(dir) ])( Produce a long directory listing. The arguments var(dir-options) and var(dir) are passed directly to the server and their effect is implementation dependent, but specifying a particular remote directory @@ -207,7 +207,7 @@ or binary. With an argument, change the type: the types `tt(A)' or `tt(IMAGE)' for binary data are understood case-insensitively. ) findex(zfstat) -item(tt(zfstat) [ -v ])( +item(tt(zfstat) [ tt(-v) ])( Show the status of the current or last connection, as well as the status of some of tt(zftp)'s status variables. With the tt(-v) option, a more verbose listing is produced by querying the server for its version of @@ -224,7 +224,7 @@ see the description of the function tt(zfrtime) below for more information. startitem() findex(zfget) -item(tt(zfget [ -Gtc ] var(file1) ...))( +item(tt(zfget) [ tt(-Gtc) ] var(file1) ...)( Retrieve all the listed files var(file1) ... one at a time from the remote server. If a file contains a `tt(/)', the full name is passed to the remote server, but the file is stored locally under the name given by the @@ -233,7 +233,7 @@ be sent as a single stream to standard output; in this case the tt(-t) option has no effect. ) findex(zfuget) -item(tt(zfuget [ -Gvst ] var(file1) ...))( +item(tt(zfuget) [ tt(-Gvst) ] var(file1) ...)( As tt(zfget), but only retrieve files where the version on the remote server is newer (has a later modification time), or where the local file does not exist. If the remote file is older but the files have different @@ -244,7 +244,7 @@ option tt(-v), the command prints more information about the files while it is working out whether or not to transfer them. ) findex(zfcget) -item(tt(zfcget [ -Gt ] var(file1) ...))( +item(tt(zfcget) [ tt(-Gt) ] var(file1) ...)( As tt(zfget), but if any of the local files exists, and is shorter than the corresponding remote file, the command assumes that it is the result of a partially completed transfer and attempts to transfer the rest of the @@ -254,8 +254,8 @@ Note that this requires a commonly implemented, but non-standard, version of the FTP protocol, so is not guaranteed to work on all servers. ) findex(zfgcp) -xitem(tt(zfgcp [ -Gt ] var(remote-file) var(local-file))) -item(tt(zfgcp [ -Gt ] var(rfile1) ... var(ldir)))( +xitem(tt(zfgcp) [ tt(-Gt) ] var(remote-file) var(local-file)) +item(tt(zfgcp) [ tt(-Gt) ] var(rfile1) ... var(ldir))( This retrieves files from the remote server with arguments behaving similarly to the tt(cp) command. @@ -271,7 +271,7 @@ enditem() subsect(Sending files) startitem() findex(zfput) -item(tt(zfput [ -r ] var(file1) ...))( +item(tt(zfput) [ tt(-r) ] var(file1) ...)( Send all the var(file1) ... given separately to the remote server. If a filename contains a `tt(/)', the full filename is used locally to find the file, but only the basename is used for the remote file name. @@ -282,13 +282,13 @@ with `tt(.)'. This requires that the remote machine understand UNIX file semantics, since `tt(/)' is used as a directory separator. ) findex(zfuput) -item(tt(zfuput [ -vs ] var(file1) ...))( +item(tt(zfuput) [ tt(-vs) ] var(file1) ...)( As tt(zfput), but only send files which are newer than their local equivalents, or if the remote file does not exist. The logic is the same as for tt(zfuget), but reversed between local and remote files. ) findex(zfcput) -item(tt(zfcput var(file1) ...))( +item(tt(zfcput) var(file1) ...)( As tt(zfput), but if any remote file already exists and is shorter than the local equivalent, assume it is the result of an incomplete transfer and send the rest of the file to append to the existing part. As the FTP @@ -296,8 +296,8 @@ append command is part of the standard set, this is in principle more likely to work than tt(zfcget). ) findex(zfpcp) -xitem(tt(zfpcp var(local-file) var(remote-file))) -item(tt(zfpcp var(lfile1) ... var(rdir)))( +xitem(tt(zfpcp) var(local-file) var(remote-file)) +item(tt(zfpcp) var(lfile1) ... var(rdir))( This sends files to the remote server with arguments behaving similarly to the tt(cp) command. @@ -381,7 +381,7 @@ directory where your zsh startup files live (usually tt(~)). startitem() findex(zfmark) -item(tt(zfmark [ )var(bookmark)tt( ]))( +item(tt(zfmark) [ var(bookmark) ])( If given an argument, mark the current host, user and directory under the name var(bookmark) for later use by tt(zfgoto). If there is no connection open, use the values for the last connection immediately before it was @@ -394,7 +394,7 @@ this is the format in which they are stored, and the file may be edited directly. ) findex(zfgoto) -item(tt(zfgoto [ -n ] )var(bookmark))( +item(tt(zfgoto) [ tt(-n) ] var(bookmark))( Return to the location given by var(bookmark), as previously set by tt(zfmark). If the location has user `tt(ftp)' or `tt(anonymous)', open the connection with tt(zfanon), so that no password is required. If the @@ -417,13 +417,13 @@ alter tt(zftp_chpwd) and tt(zftp_progress), in particular. startitem() findex(zfinit) -item(tt(zfinit [ -n ]))( +item(tt(zfinit) [ tt(-n) ])( As described above, this is used to initialize the zftp function system. The tt(-n) option should be used if the zftp command is already built into the shell. ) findex(zfautocheck) -item(tt(zfautocheck [ -dn ]))( +item(tt(zfautocheck) [ tt(-dn) ])( This function is called to implement automatic reopening behaviour, as described in more detail below. The options must appear in the first argument; tt(-n) prevents the command from changing to the old directory, @@ -458,7 +458,7 @@ were any matches, the same variable will be set to the expanded set of filenames on return. ) findex(zfrtime) -item(tt(zfrtime var(lfile) var(rfile) [ var(time) ]))( +item(tt(zfrtime) var(lfile) var(rfile) [ var(time) ])( Set the local file var(lfile) to have the same modification time as the remote file var(rfile), or the explicit time var(time) in FTP format tt(CCYYMMDDhhmmSS) for the GMT timezone. This uses the shell's @@ -556,12 +556,12 @@ As described for tt(progress), tt(zfinit) will force this to default to 1. ) kindex(remote-glob, zftp style) item(tt(remote-glob))( -If set to `1', `yes' or `true', filename generation (globbing) is +If set to `tt(1)', `tt(yes)' or `tt(true)', filename generation (globbing) is performed on the remote machine instead of by zsh itself; see below. ) kindex(titlebar, zftp style) item(tt(titlebar))( -If set to `1', `yes' or `true', tt(zftp_chpwd) will put the remote host and +If set to `tt(1)', `tt(yes)' or `tt(true)', tt(zftp_chpwd) will put the remote host and remote directory into the titlebar of terminal emulators such as xterm or sun-cmd that allow this. @@ -569,7 +569,7 @@ As described for tt(progress), tt(zfinit) will force this to default to 1. ) kindex(chpwd, zftp style) item(tt(chpwd))( -If set to `1' `yes' or `true', tt(zftp_chpwd) will call the function +If set to `tt(1)' `tt(yes)' or `tt(true)', tt(zftp_chpwd) will call the function tt(chpwd) when a connection is closed. This is useful if the remote host details were put into the terminal title bar by tt(zftp_chpwd) and your usual tt(chpwd) also modifies the title bar. diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 653678eba..16d661f06 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -25,12 +25,12 @@ vindex(BAUD, use of) vindex(COLUMNS, use of) vindex(LINES, use of) The parameters tt(BAUD), tt(COLUMNS), and tt(LINES) are also used by the -line editor. -ifzman(See em(Parameters Used By The Shell) in zmanref(zshparam))\ +line editor. See +ifzman(em(Parameters Used By The Shell) in zmanref(zshparam))\ ifnzman(noderef(Parameters Used By The Shell)). -The parameter tt(zle_highlight) is also used by the line editor; -ifzman(see em(Character Highlighting) below)\ +The parameter tt(zle_highlight) is also used by the line editor; see +ifzman(em(Character Highlighting) below)\ ifnzman(noderef(Character Highlighting)). Highlighting of special characters and the region between the cursor and the mark (as set with tt(set-mark-command) in Emacs mode) is enabled @@ -131,9 +131,9 @@ detect loops the process will be stopped if there are twenty such replacements without a real command being read. A key sequence typed by the user can be turned into a command name for use -in user-defined widgets with the tt(read-command) widget, described -ifzman(below)\ -ifnzman(in noderef(Miscellaneous) below)\ +in user-defined widgets with the tt(read-command) widget, described in +ifzman(the subsection `Miscellaneous' of the section `Standard Widgets' below)\ +ifnzman(noderef(Miscellaneous) below)\ . subsect(Local Keymaps) cindex(local keymaps) @@ -141,7 +141,7 @@ While for normal editing a single keymap is used exclusively, in many modes a local keymap allows for some keys to be customised. For example, in an incremental search mode, a binding in the tt(isearch) keymap will override a binding in the tt(main) keymap but all keys that are not -overriden can still be used. +overridden can still be used. If a key sequence is defined in a local keymap, it will hide a key sequence in the global keymap that is a prefix of that sequence. An @@ -339,10 +339,11 @@ by `tt(bindkey -m)'. findex(vared) cindex(parameters, editing) cindex(editing parameters) -xitem(tt(vared) [ tt(-Aache) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ]) -xitem( [ tt(-M) var(main-keymap) ] [ tt(-m) var(vicmd-keymap) ]) -xitem( [ tt(-i) var(init-widget) ] [ tt(-f) var(finish-widget) ]) -item( [ tt(-t) var(tty) ] var(name))( +redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( ))) +xitem(tt(vared )[ tt(-Aache) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ]) +xitem(SPACES()[ tt(-M) var(main-keymap) ] [ tt(-m) var(vicmd-keymap) ]) +xitem(SPACES()[ tt(-i) var(init-widget) ] [ tt(-f) var(finish-widget) ]) +item(SPACES()[ tt(-t) var(tty) ] var(name))( The value of the parameter var(name) is loaded into the edit buffer, and the line editor is invoked. When the editor exits, var(name) is set to the string value returned by the editor. @@ -409,7 +410,7 @@ xitem(tt(zle) tt(-K) var(keymap)) xitem(tt(zle) tt(-F) [ tt(-L) | tt(-w) ] [ var(fd) [ var(handler) ] ]) xitem(tt(zle) tt(-I)) xitem(tt(zle) tt(-T) [ tt(tc) var(function) | tt(-r) tt(tc) | tt(-L) ] ) -item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( +item(tt(zle) var(widget) [ tt(-n) var(num) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)( The tt(zle) builtin performs a number of different actions concerning ZLE. @@ -423,7 +424,7 @@ widgets. Otherwise, which operation it performs depends on its options: startitem() -item(tt(-l) [ tt(-L) | tt(-a) ])( +item(tt(-l) [ tt(-L) | tt(-a) ] [ var(string) ])( List all existing user-defined widgets. If the tt(-L) option is used, list in the form of tt(zle) commands to create the widgets. @@ -456,10 +457,9 @@ Create a user-defined widget. If there is already a widget with the specified name, it is overwritten. When the new widget is invoked from within the editor, the specified shell var(function) is called. If no function name is specified, it defaults to -the same name as the widget. For further information, see the section -em(Widgets) in -ifzman(zmanref(zshzle))\ -ifnzman(noderef(Zsh Line Editor))\ +the same name as the widget. For further information, see +ifzman(the section `Widgets' below)\ +ifnzman(noderef(Zle Widgets))\ . ) cindex(completion widgets, creating) @@ -607,9 +607,9 @@ restoring, hence the following will print output in such a way as not to disturb the line being edited: example(TRAPUSR1() { - # Invalidate zle display + # Invalidate zle display [[ -o zle ]] && zle -I - # Show output + # Show output print Hello }) @@ -656,12 +656,12 @@ optional argument for debugging or testing. Note that this transformation is not applied to other non-printing characters such as carriage returns and newlines. ) -item(var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(args) ...)( -Invoke the specified widget. This can only be done when ZLE is +item(var(widget) [ tt(-n) var(num) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)( +Invoke the specified var(widget). This can only be done when ZLE is active; normally this will be within a user-defined widget. With the options tt(-n) and tt(-N), the current numeric argument will be -saved and then restored after the call to tt(widget); `tt(-n) var(num)' +saved and then restored after the call to var(widget); `tt(-n) var(num)' sets the numeric argument temporarily to var(num), while `tt(-N)' sets it to the default, i.e. as if there were none. @@ -913,8 +913,8 @@ item(tt(REGION_ACTIVE) (integer))( Indicates if the region is currently active. It can be assigned 0 or 1 to deactivate and activate the region respectively. A value of 2 activates the region in line-wise mode with the highlighted text -extending for whole lines only; -ifzman(see em(Character Highlighting) below)\ +extending for whole lines only; see +ifzman(em(Character Highlighting) below)\ ifnzman(noderef(Character Highlighting)). ) vindex(region_highlight) @@ -938,9 +938,9 @@ whitespace.) itemiz(An end offset in the same units as tt(CURSOR), terminated by whitespace.) itemiz(A highlight specification in the same format as -used for contexts in the parameter tt(zle_highlight), +used for contexts in the parameter tt(zle_highlight), see ifnzman(noderef(Character Highlighting))\ -ifzman(see Character Highlighting below); +ifzman(the section `Character Highlighting' below); for example, tt(standout) or tt(fg=red,bold)). enditemize() @@ -1096,25 +1096,25 @@ texinode(Movement)(History Control)()(Zle Widgets) subsect(Movement) startitem() tindex(vi-backward-blank-word) -item(tt(vi-backward-blank-word) (unbound) (B) (unbound))( +item(tt(vi-backward-blank-word) (unbound) (tt(B)) (unbound))( Move backward one word, where a word is defined as a series of non-blank characters. ) tindex(vi-backward-blank-word-end) -item(tt(vi-backward-blank-word-end) (unbound) (gE) (unbound))( +item(tt(vi-backward-blank-word-end) (unbound) (tt(gE)) (unbound))( Move to the end of the previous word, where a word is defined as a series of non-blank characters. ) tindex(backward-char) -item(tt(backward-char) (^B ESC-[D) (unbound) (unbound))( +item(tt(backward-char) (tt(^B ESC-[D)) (unbound) (unbound))( Move backward one character. ) tindex(vi-backward-char) -item(tt(vi-backward-char) (unbound) (^H h ^?) (ESC-[D))( +item(tt(vi-backward-char) (unbound) (tt(^H h ^?)) (tt(ESC-[D)))( Move backward one character, without changing lines. ) tindex(backward-word) -item(tt(backward-word) (ESC-B ESC-b) (unbound) (unbound))( +item(tt(backward-word) (tt(ESC-B ESC-b)) (unbound) (unbound))( Move to the beginning of the previous word. ) tindex(emacs-backward-word) @@ -1122,15 +1122,15 @@ item(tt(emacs-backward-word))( Move to the beginning of the previous word. ) tindex(vi-backward-word) -item(tt(vi-backward-word) (unbound) (b) (unbound))( +item(tt(vi-backward-word) (unbound) (tt(b)) (unbound))( Move to the beginning of the previous word, vi-style. ) tindex(vi-backward-word-end) -item(tt(vi-backward-word-end) (unbound) (ge) (unbound))( +item(tt(vi-backward-word-end) (unbound) (tt(ge)) (unbound))( Move to the end of the previous word, vi-style. ) tindex(beginning-of-line) -item(tt(beginning-of-line) (^A) (unbound) (unbound))( +item(tt(beginning-of-line) (tt(^A)) (unbound) (unbound))( Move to the beginning of the line. If already at the beginning of the line, move to the beginning of the previous line, if any. ) @@ -1143,65 +1143,65 @@ item(tt(down-line) (unbound) (unbound) (unbound))( Move down a line in the buffer. ) tindex(end-of-line) -item(tt(end-of-line) (^E) (unbound) (unbound))( +item(tt(end-of-line) (tt(^E)) (unbound) (unbound))( Move to the end of the line. If already at the end of the line, move to the end of the next line, if any. ) tindex(vi-end-of-line) -item(tt(vi-end-of-line) (unbound) ($) (unbound))( +item(tt(vi-end-of-line) (unbound) (tt($)) (unbound))( Move to the end of the line. If an argument is given to this command, the cursor will be moved to the end of the line (argument - 1) lines down. ) tindex(vi-forward-blank-word) -item(tt(vi-forward-blank-word) (unbound) (W) (unbound))( +item(tt(vi-forward-blank-word) (unbound) (tt(W)) (unbound))( Move forward one word, where a word is defined as a series of non-blank characters. ) tindex(vi-forward-blank-word-end) -item(tt(vi-forward-blank-word-end) (unbound) (E) (unbound))( +item(tt(vi-forward-blank-word-end) (unbound) (tt(E)) (unbound))( Move to the end of the current word, or, if at the end of the current word, to the end of the next word, where a word is defined as a series of non-blank characters. ) tindex(forward-char) -item(tt(forward-char) (^F ESC-[C) (unbound) (unbound))( +item(tt(forward-char) (tt(^F ESC-[C)) (unbound) (unbound))( Move forward one character. ) tindex(vi-forward-char) -item(tt(vi-forward-char) (unbound) (space l) (ESC-[C))( +item(tt(vi-forward-char) (unbound) (tt(space l)) (tt(ESC-[C)))( Move forward one character. ) tindex(vi-find-next-char) -item(tt(vi-find-next-char) (^X^F) (f) (unbound))( +item(tt(vi-find-next-char) (tt(^X^F)) (tt(f)) (unbound))( Read a character from the keyboard, and move to the next occurrence of it in the line. ) tindex(vi-find-next-char-skip) -item(tt(vi-find-next-char-skip) (unbound) (t) (unbound))( +item(tt(vi-find-next-char-skip) (unbound) (tt(t)) (unbound))( Read a character from the keyboard, and move to the position just before the next occurrence of it in the line. ) tindex(vi-find-prev-char) -item(tt(vi-find-prev-char) (unbound) (F) (unbound))( +item(tt(vi-find-prev-char) (unbound) (tt(F)) (unbound))( Read a character from the keyboard, and move to the previous occurrence of it in the line. ) tindex(vi-find-prev-char-skip) -item(tt(vi-find-prev-char-skip) (unbound) (T) (unbound))( +item(tt(vi-find-prev-char-skip) (unbound) (tt(T)) (unbound))( Read a character from the keyboard, and move to the position just after the previous occurrence of it in the line. ) tindex(vi-first-non-blank) -item(tt(vi-first-non-blank) (unbound) (^) (unbound))( +item(tt(vi-first-non-blank) (unbound) (tt(^)) (unbound))( Move to the first non-blank character in the line. ) tindex(vi-forward-word) -item(tt(vi-forward-word) (unbound) (w) (unbound))( +item(tt(vi-forward-word) (unbound) (tt(w)) (unbound))( Move forward one word, vi-style. ) tindex(forward-word) -item(tt(forward-word) (ESC-F ESC-f) (unbound) (unbound))( +item(tt(forward-word) (tt(ESC-F ESC-f)) (unbound) (unbound))( Move to the beginning of the next word. The editor's idea of a word is specified with the tt(WORDCHARS) parameter. @@ -1211,27 +1211,27 @@ item(tt(emacs-forward-word))( Move to the end of the next word. ) tindex(vi-forward-word-end) -item(tt(vi-forward-word-end) (unbound) (e) (unbound))( +item(tt(vi-forward-word-end) (unbound) (tt(e)) (unbound))( Move to the end of the next word. ) tindex(vi-goto-column) -item(tt(vi-goto-column) (ESC-|) (|) (unbound))( +item(tt(vi-goto-column) (tt(ESC-|)) (tt(|)) (unbound))( Move to the column specified by the numeric argument. ) tindex(vi-goto-mark) -item(tt(vi-goto-mark) (unbound) (`) (unbound))( +item(tt(vi-goto-mark) (unbound) (tt(`)) (unbound))( Move to the specified mark. ) tindex(vi-goto-mark-line) -item(tt(vi-goto-mark-line) (unbound) (') (unbound))( +item(tt(vi-goto-mark-line) (unbound) (tt(')) (unbound))( Move to beginning of the line containing the specified mark. ) tindex(vi-repeat-find) -item(tt(vi-repeat-find) (unbound) (;) (unbound))( +item(tt(vi-repeat-find) (unbound) (tt(;)) (unbound))( Repeat the last tt(vi-find) command. ) tindex(vi-rev-repeat-find) -item(tt(vi-rev-repeat-find) (unbound) (,) (unbound))( +item(tt(vi-rev-repeat-find) (unbound) (tt(,)) (unbound))( Repeat the last tt(vi-find) command in the opposite direction. ) tindex(up-line) @@ -1243,7 +1243,7 @@ texinode(History Control)(Modifying Text)(Movement)(Zle Widgets) subsect(History Control) startitem() tindex(beginning-of-buffer-or-history) -item(tt(beginning-of-buffer-or-history) (ESC-<) (gg) (unbound))( +item(tt(beginning-of-buffer-or-history) (tt(ESC-<)) (tt(gg)) (unbound))( Move to the beginning of the buffer, or if already there, move to the first event in the history list. ) @@ -1257,12 +1257,12 @@ item(tt(beginning-of-history))( Move to the first event in the history list. ) tindex(down-line-or-history) -item(tt(down-line-or-history) (^N ESC-[B) (j) (ESC-[B))( +item(tt(down-line-or-history) (tt(^N ESC-[B)) (tt(j)) (tt(ESC-[B)))( Move down a line in the buffer, or if already at the bottom line, move to the next event in the history list. ) tindex(vi-down-line-or-history) -item(tt(vi-down-line-or-history) (unbound) (PLUS()) (unbound))( +item(tt(vi-down-line-or-history) (unbound) (tt(PLUS())) (unbound))( Move down a line in the buffer, or if already at the bottom line, move to the next event in the history list. Then move to the first non-blank character on the line. @@ -1278,7 +1278,7 @@ argument is taken as the string for which to search, rather than the first word in the buffer. ) tindex(down-history) -item(tt(down-history) (unbound) (^N) (unbound))( +item(tt(down-history) (unbound) (tt(^N)) (unbound))( Move to the next event in the history list. ) tindex(history-beginning-search-backward) @@ -1288,7 +1288,7 @@ line up to the cursor. This leaves the cursor in its original position. ) tindex(end-of-buffer-or-history) -item(tt(end-of-buffer-or-history) (ESC->) (unbound) (unbound))( +item(tt(end-of-buffer-or-history) (tt(ESC->)) (unbound) (unbound))( Move to the end of the buffer, or if already there, move to the last event in the history list. ) @@ -1302,13 +1302,13 @@ item(tt(end-of-history))( Move to the last event in the history list. ) tindex(vi-fetch-history) -item(tt(vi-fetch-history) (unbound) (G) (unbound))( +item(tt(vi-fetch-history) (unbound) (tt(G)) (unbound))( Fetch the history line specified by the numeric argument. This defaults to the current history line (i.e. the one that isn't history yet). ) tindex(history-incremental-search-backward) -item(tt(history-incremental-search-backward) (^R ^Xr) (unbound) (unbound))( +item(tt(history-incremental-search-backward) (tt(^R ^Xr)) (unbound) (unbound))( Search backward incrementally for a specified string. The search is case-insensitive if the search string does not have uppercase letters and no numeric argument was given. The string may begin with `tt(^)' to anchor the @@ -1406,7 +1406,7 @@ will search backwards for tt(forceps), leaving the minibuffer containing the string `tt(forceps)'. ) tindex(history-incremental-search-forward) -item(tt(history-incremental-search-forward) (^S ^Xs) (unbound) (unbound))( +item(tt(history-incremental-search-forward) (tt(^S ^Xs)) (unbound) (unbound))( Search forward incrementally for a specified string. The search is case-insensitive if the search string does not have uppercase letters and no numeric argument was given. The string may begin with `tt(^)' to anchor the @@ -1435,7 +1435,7 @@ with wildcards may return fewer matches on a line than are visible by inspection. ) tindex(history-search-backward) -item(tt(history-search-backward) (ESC-P ESC-p) (unbound) (unbound))( +item(tt(history-search-backward) (tt(ESC-P ESC-p)) (unbound) (unbound))( Search backward in the history for a line beginning with the first word in the buffer. @@ -1444,7 +1444,7 @@ argument is taken as the string for which to search, rather than the first word in the buffer. ) tindex(vi-history-search-backward) -item(tt(vi-history-search-backward) (unbound) (/) (unbound))( +item(tt(vi-history-search-backward) (unbound) (tt(/)) (unbound))( Search backward in the history for a specified string. The string may begin with `tt(^)' to anchor the search to the beginning of the line. @@ -1475,7 +1475,7 @@ argument is taken as the string for which to search, rather than the first word in the buffer. ) tindex(history-search-forward) -item(tt(history-search-forward) (ESC-N ESC-n) (unbound) (unbound))( +item(tt(history-search-forward) (tt(ESC-N ESC-n)) (unbound) (unbound))( Search forward in the history for a line beginning with the first word in the buffer. @@ -1484,7 +1484,7 @@ argument is taken as the string for which to search, rather than the first word in the buffer. ) tindex(vi-history-search-forward) -item(tt(vi-history-search-forward) (unbound) (?) (unbound))( +item(tt(vi-history-search-forward) (unbound) (tt(?)) (unbound))( Search forward in the history for a specified string. The string may begin with `tt(^)' to anchor the search to the beginning of the line. The functions available in the mini-buffer are the same @@ -1492,12 +1492,12 @@ as for tt(vi-history-search-backward). Argument handling is also the same as for that command. ) tindex(infer-next-history) -item(tt(infer-next-history) (^X^N) (unbound) (unbound))( +item(tt(infer-next-history) (tt(^X^N)) (unbound) (unbound))( Search in the history list for a line matching the current one and fetch the event following it. ) tindex(insert-last-word) -item(tt(insert-last-word) (ESC-_ ESC-.) (unbound) (unbound))( +item(tt(insert-last-word) (tt(ESC-_ ESC-.)) (unbound) (unbound))( Insert the last word from the previous history event at the cursor position. If a positive numeric argument is given, insert that word from the end of the previous history event. @@ -1539,20 +1539,20 @@ the line being edited. This has the side effect that later invocations of the widget will be relative to that line. ) tindex(vi-repeat-search) -item(tt(vi-repeat-search) (unbound) (n) (unbound))( +item(tt(vi-repeat-search) (unbound) (tt(n)) (unbound))( Repeat the last vi history search. ) tindex(vi-rev-repeat-search) -item(tt(vi-rev-repeat-search) (unbound) (N) (unbound))( +item(tt(vi-rev-repeat-search) (unbound) (tt(N)) (unbound))( Repeat the last vi history search, but in reverse. ) tindex(up-line-or-history) -item(tt(up-line-or-history) (^P ESC-[A) (k) (ESC-[A))( +item(tt(up-line-or-history) (tt(^P ESC-[A)) (tt(k)) (tt(ESC-[A)))( Move up a line in the buffer, or if already at the top line, move to the previous event in the history list. ) tindex(vi-up-line-or-history) -item(tt(vi-up-line-or-history) (unbound) (-) (unbound))( +item(tt(vi-up-line-or-history) (unbound) (tt(-)) (unbound))( Move up a line in the buffer, or if already at the top line, move to the previous event in the history list. Then move to the first non-blank character on the line. @@ -1568,7 +1568,7 @@ argument is taken as the string for which to search, rather than the first word in the buffer. ) tindex(up-history) -item(tt(up-history) (unbound) (^P) (unbound))( +item(tt(up-history) (unbound) (tt(^P)) (unbound))( Move to the previous event in the history list. ) tindex(history-beginning-search-forward) @@ -1589,19 +1589,19 @@ texinode(Modifying Text)(Arguments)(History Control)(Zle Widgets) subsect(Modifying Text) startitem() tindex(vi-add-eol) -item(tt(vi-add-eol) (unbound) (A) (unbound))( +item(tt(vi-add-eol) (unbound) (tt(A)) (unbound))( Move to the end of the line and enter insert mode. ) tindex(vi-add-next) -item(tt(vi-add-next) (unbound) (a) (unbound))( +item(tt(vi-add-next) (unbound) (tt(a)) (unbound))( Enter insert mode after the current cursor position, without changing lines. ) tindex(backward-delete-char) -item(tt(backward-delete-char) (^H ^?) (unbound) (unbound))( +item(tt(backward-delete-char) (tt(^H ^?)) (unbound) (unbound))( Delete the character behind the cursor. ) tindex(vi-backward-delete-char) -item(tt(vi-backward-delete-char) (unbound) (X) (^H))( +item(tt(vi-backward-delete-char) (unbound) (tt(X)) (tt(^H)))( Delete the character behind the cursor, without changing lines. If in insert mode, this won't delete past the point where insert mode was last entered. @@ -1615,20 +1615,20 @@ item(tt(backward-kill-line))( Kill from the beginning of the line to the cursor position. ) tindex(backward-kill-word) -item(tt(backward-kill-word) (^W ESC-^H ESC-^?) (unbound) (unbound))( +item(tt(backward-kill-word) (tt(^W ESC-^H ESC-^?)) (unbound) (unbound))( Kill the word behind the cursor. ) tindex(vi-backward-kill-word) -item(tt(vi-backward-kill-word) (unbound) (unbound) (^W))( +item(tt(vi-backward-kill-word) (unbound) (unbound) (tt(^W)))( Kill the word behind the cursor, without going past the point where insert mode was last entered. ) tindex(capitalize-word) -item(tt(capitalize-word) (ESC-C ESC-c) (unbound) (unbound))( +item(tt(capitalize-word) (tt(ESC-C ESC-c)) (unbound) (unbound))( Capitalize the current word and move past it. ) tindex(vi-change) -item(tt(vi-change) (unbound) (c) (unbound))( +item(tt(vi-change) (unbound) (tt(c)) (unbound))( Read a movement command from the keyboard, and kill from the cursor position to the endpoint of the movement. Then enter insert mode. @@ -1642,15 +1642,15 @@ whitespace included use the following key binding: example(bindkey -a -s cw dwi) ) tindex(vi-change-eol) -item(tt(vi-change-eol) (unbound) (C) (unbound))( +item(tt(vi-change-eol) (unbound) (tt(C)) (unbound))( Kill to the end of the line and enter insert mode. ) tindex(vi-change-whole-line) -item(tt(vi-change-whole-line) (unbound) (S) (unbound))( +item(tt(vi-change-whole-line) (unbound) (tt(S)) (unbound))( Kill the current line and enter insert mode. ) tindex(copy-region-as-kill) -item(tt(copy-region-as-kill) (ESC-W ESC-w) (unbound) (unbound))( +item(tt(copy-region-as-kill) (tt(ESC-W ESC-w)) (unbound) (unbound))( Copy the area from the cursor to the mark to the kill buffer. If called from a ZLE widget function in the form `tt(zle @@ -1659,7 +1659,7 @@ text to copy to the kill buffer. The cursor, the mark and the text on the command line are not used in this case. ) tindex(copy-prev-word) -item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))( +item(tt(copy-prev-word) (tt(ESC-^_)) (unbound) (unbound))( Duplicate the word to the left of the cursor. ) tindex(copy-prev-shell-word) @@ -1669,7 +1669,7 @@ whereas tt(copy-prev-word) looks for blanks. This makes a difference when the word is quoted and contains spaces. ) tindex(vi-delete) -item(tt(vi-delete) (unbound) (d) (unbound))( +item(tt(vi-delete) (unbound) (tt(d)) (unbound))( Read a movement command from the keyboard, and kill from the cursor position to the endpoint of the movement. If the command is tt(vi-delete), kill the current line. @@ -1679,7 +1679,7 @@ item(tt(delete-char))( Delete the character under the cursor. ) tindex(vi-delete-char) -item(tt(vi-delete-char) (unbound) (x) (unbound))( +item(tt(vi-delete-char) (unbound) (tt(x)) (unbound))( Delete the character under the cursor, without going past the end of the line. ) @@ -1688,11 +1688,11 @@ item(tt(delete-word))( Delete the current word. ) tindex(down-case-word) -item(tt(down-case-word) (ESC-L ESC-l) (unbound) (unbound))( +item(tt(down-case-word) (tt(ESC-L ESC-l)) (unbound) (unbound))( Convert the current word to all lowercase and move past it. ) tindex(kill-word) -item(tt(kill-word) (ESC-D ESC-d) (unbound) (unbound))( +item(tt(kill-word) (tt(ESC-D ESC-d)) (unbound) (unbound))( Kill the current word. ) tindex(gosmacs-transpose-chars) @@ -1700,32 +1700,32 @@ item(tt(gosmacs-transpose-chars))( Exchange the two characters behind the cursor. ) tindex(vi-indent) -item(tt(vi-indent) (unbound) (>) (unbound))( +item(tt(vi-indent) (unbound) (tt(>)) (unbound))( Indent a number of lines. ) tindex(vi-insert) -item(tt(vi-insert) (unbound) (i) (unbound))( +item(tt(vi-insert) (unbound) (tt(i)) (unbound))( Enter insert mode. ) tindex(vi-insert-bol) -item(tt(vi-insert-bol) (unbound) (I) (unbound))( +item(tt(vi-insert-bol) (unbound) (tt(I)) (unbound))( Move to the first non-blank character on the line and enter insert mode. ) tindex(vi-join) -item(tt(vi-join) (^X^J) (J) (unbound))( +item(tt(vi-join) (tt(^X^J)) (tt(J)) (unbound))( Join the current line with the next one. ) tindex(kill-line) -item(tt(kill-line) (^K) (unbound) (unbound))( +item(tt(kill-line) (tt(^K)) (unbound) (unbound))( Kill from the cursor to the end of the line. If already on the end of the line, kill the newline character. ) tindex(vi-kill-line) -item(tt(vi-kill-line) (unbound) (unbound) (^U))( +item(tt(vi-kill-line) (unbound) (unbound) (tt(^U)))( Kill from the cursor back to wherever insert mode was last entered. ) tindex(vi-kill-eol) -item(tt(vi-kill-eol) (unbound) (D) (unbound))( +item(tt(vi-kill-eol) (unbound) (tt(D)) (unbound))( Kill from the cursor to the end of the line. ) tindex(kill-region) @@ -1733,30 +1733,30 @@ item(tt(kill-region))( Kill from the cursor to the mark. ) tindex(kill-buffer) -item(tt(kill-buffer) (^X^K) (unbound) (unbound))( +item(tt(kill-buffer) (tt(^X^K)) (unbound) (unbound))( Kill the entire buffer. ) tindex(kill-whole-line) -item(tt(kill-whole-line) (^U) (unbound) (unbound))( +item(tt(kill-whole-line) (tt(^U)) (unbound) (unbound))( Kill the current line. ) tindex(vi-match-bracket) -item(tt(vi-match-bracket) (^X^B) (%) (unbound))( +item(tt(vi-match-bracket) (tt(^X^B)) (tt(%)) (unbound))( Move to the bracket character (one of tt({}), tt(()) or tt([])) that matches the one under the cursor. If the cursor is not on a bracket character, move forward without going past the end of the line to find one, and then go to the matching bracket. ) tindex(vi-open-line-above) -item(tt(vi-open-line-above) (unbound) (O) (unbound))( +item(tt(vi-open-line-above) (unbound) (tt(O)) (unbound))( Open a line above the cursor and enter insert mode. ) tindex(vi-open-line-below) -item(tt(vi-open-line-below) (unbound) (o) (unbound))( +item(tt(vi-open-line-below) (unbound) (tt(o)) (unbound))( Open a line below the cursor and enter insert mode. ) tindex(vi-oper-swap-case) -item(tt(vi-oper-swap-case) (unbound) (g~) (unbound))( +item(tt(vi-oper-swap-case) (unbound) (tt(g~)) (unbound))( Read a movement command from the keyboard, and swap the case of all characters from the cursor position to the endpoint of the movement. @@ -1764,17 +1764,17 @@ If the movement command is tt(vi-oper-swap-case), swap the case of all characters on the current line. ) tindex(overwrite-mode) -item(tt(overwrite-mode) (^X^O) (unbound) (unbound))( +item(tt(overwrite-mode) (tt(^X^O)) (unbound) (unbound))( Toggle between overwrite mode and insert mode. ) tindex(vi-put-before) -item(tt(vi-put-before) (unbound) (P) (unbound))( +item(tt(vi-put-before) (unbound) (tt(P)) (unbound))( Insert the contents of the kill buffer before the cursor. If the kill buffer contains a sequence of lines (as opposed to characters), paste it above the current line. ) tindex(vi-put-after) -item(tt(vi-put-after) (unbound) (p) (unbound))( +item(tt(vi-put-after) (unbound) (tt(p)) (unbound))( Insert the contents of the kill buffer after the cursor. If the kill buffer contains a sequence of lines (as opposed to characters), paste it below the current line. @@ -1787,32 +1787,32 @@ lines (as opposed to characters), the current line will be split by the pasted lines. ) tindex(quoted-insert) -item(tt(quoted-insert) (^V) (unbound) (unbound))( +item(tt(quoted-insert) (tt(^V)) (unbound) (unbound))( Insert the next character typed into the buffer literally. An interrupt character will not be inserted. ) tindex(vi-quoted-insert) -item(tt(vi-quoted-insert) (unbound) (unbound) (^Q ^V))( +item(tt(vi-quoted-insert) (unbound) (unbound) (tt(^Q ^V)))( Display a `tt(^)' at the cursor position, and insert the next character typed into the buffer literally. An interrupt character will not be inserted. ) tindex(quote-line) -item(tt(quote-line) (ESC-') (unbound) (unbound))( +item(tt(quote-line) (tt(ESC-')) (unbound) (unbound))( Quote the current line; that is, put a `tt(')' character at the beginning and the end, and convert all `tt(')' characters to `tt('\'')'. ) tindex(quote-region) -item(tt(quote-region) (ESC-") (unbound) (unbound))( +item(tt(quote-region) (tt(ESC-")) (unbound) (unbound))( Quote the region from the cursor to the mark. ) tindex(vi-replace) -item(tt(vi-replace) (unbound) (R) (unbound))( +item(tt(vi-replace) (unbound) (tt(R)) (unbound))( Enter overwrite mode. ) tindex(vi-repeat-change) -item(tt(vi-repeat-change) (unbound) (.) (unbound))( +item(tt(vi-repeat-change) (unbound) (tt(.)) (unbound))( Repeat the last vi mode text modification. If a count was used with the modification, it is remembered. If a count is given to this command, it overrides the remembered count, @@ -1820,7 +1820,7 @@ and is remembered for future uses of this command. The cut buffer specification is similarly remembered. ) tindex(vi-replace-chars) -item(tt(vi-replace-chars) (unbound) (r) (unbound))( +item(tt(vi-replace-chars) (unbound) (tt(r)) (unbound))( Replace the character under the cursor with a character read from the keyboard. ) @@ -1829,56 +1829,56 @@ item(tt(self-insert) (printable characters) (unbound) (printable characters and Insert a character into the buffer at the cursor position. ) tindex(self-insert-unmeta) -item(tt(self-insert-unmeta) (ESC-^I ESC-^J ESC-^M) (unbound) (unbound))( +item(tt(self-insert-unmeta) (tt(ESC-^I ESC-^J ESC-^M)) (unbound) (unbound))( Insert a character into the buffer after stripping the meta bit and converting ^M to ^J. ) tindex(vi-substitute) -item(tt(vi-substitute) (unbound) (s) (unbound))( +item(tt(vi-substitute) (unbound) (tt(s)) (unbound))( Substitute the next characte+CHAR(r)(s). ) tindex(vi-swap-case) -item(tt(vi-swap-case) (unbound) (~) (unbound))( +item(tt(vi-swap-case) (unbound) (tt(~)) (unbound))( Swap the case of the character under the cursor and move past it. ) tindex(transpose-chars) -item(tt(transpose-chars) (^T) (unbound) (unbound))( +item(tt(transpose-chars) (tt(^T)) (unbound) (unbound))( Exchange the two characters to the left of the cursor if at end of line, else exchange the character under the cursor with the character to the left. ) tindex(transpose-words) -item(tt(transpose-words) (ESC-T ESC-t) (unbound) (unbound))( +item(tt(transpose-words) (tt(ESC-T ESC-t)) (unbound) (unbound))( Exchange the current word with the one before it. ) tindex(vi-unindent) -item(tt(vi-unindent) (unbound) (<) (unbound))( +item(tt(vi-unindent) (unbound) (tt(<)) (unbound))( Unindent a number of lines. ) tindex(up-case-word) -item(tt(up-case-word) (ESC-U ESC-u) (unbound) (unbound))( +item(tt(up-case-word) (tt(ESC-U ESC-u)) (unbound) (unbound))( Convert the current word to all caps and move past it. ) tindex(yank) -item(tt(yank) (^Y) (unbound) (unbound))( +item(tt(yank) (tt(^Y)) (unbound) (unbound))( Insert the contents of the kill buffer at the cursor position. ) tindex(yank-pop) -item(tt(yank-pop) (ESC-y) (unbound) (unbound))( +item(tt(yank-pop) (tt(ESC-y)) (unbound) (unbound))( Remove the text just yanked, rotate the kill-ring (the history of previously killed text) and yank the new top. Only works following tt(yank), tt(vi-put-before), tt(vi-put-after) or tt(yank-pop). ) tindex(vi-yank) -item(tt(vi-yank) (unbound) (y) (unbound))( +item(tt(vi-yank) (unbound) (tt(y)) (unbound))( Read a movement command from the keyboard, and copy the region from the cursor position to the endpoint of the movement into the kill buffer. If the command is tt(vi-yank), copy the current line. ) tindex(vi-yank-whole-line) -item(tt(vi-yank-whole-line) (unbound) (Y) (unbound))( +item(tt(vi-yank-whole-line) (unbound) (tt(Y)) (unbound))( Copy the current line into the kill buffer. ) tindex(vi-yank-eol) @@ -1892,7 +1892,7 @@ texinode(Arguments)(Completion)(Modifying Text)(Zle Widgets) subsect(Arguments) startitem() tindex(digit-argument) -item(tt(digit-argument) (ESC-0..ESC-9) (1-9) (unbound))( +item(tt(digit-argument) (tt(ESC-0)..tt(ESC-9)) (tt(1)-tt(9)) (unbound))( Start a new numeric argument, or add to the current one. See also tt(vi-digit-or-beginning-of-line). This only works if bound to a key sequence ending in a decimal digit. @@ -1901,7 +1901,7 @@ Inside a widget function, a call to this function treats the last key of the key sequence which called the widget as the digit. ) tindex(neg-argument) -item(tt(neg-argument) (ESC-DASH()) (unbound) (unbound))( +item(tt(neg-argument) (tt(ESC-)tt(-)) (unbound) (unbound))( Changes the sign of the following argument. ) tindex(universal-argument) @@ -1949,7 +1949,7 @@ item(tt(complete-word))( Attempt completion on the current word. ) tindex(delete-char-or-list) -item(tt(delete-char-or-list) (^D) (unbound) (unbound))( +item(tt(delete-char-or-list) (tt(^D)) (unbound) (unbound))( Delete the character under the cursor. If the cursor is at the end of the line, list possible completions for the current word. @@ -1959,7 +1959,7 @@ item(tt(expand-cmd-path))( Expand the current command to its full pathname. ) tindex(expand-or-complete) -item(tt(expand-or-complete) (TAB) (unbound) (TAB))( +item(tt(expand-or-complete) (tt(TAB)) (unbound) (tt(TAB)))( Attempt shell expansion on the current word. If that fails, attempt completion. @@ -1969,19 +1969,19 @@ item(tt(expand-or-complete-prefix))( Attempt shell expansion on the current word up to cursor. ) tindex(expand-history) -item(tt(expand-history) (ESC-space ESC-!) (unbound) (unbound))( +item(tt(expand-history) (tt(ESC-space ESC-!)) (unbound) (unbound))( Perform history expansion on the edit buffer. ) tindex(expand-word) -item(tt(expand-word) (^X*) (unbound) (unbound))( +item(tt(expand-word) (tt(^X*)) (unbound) (unbound))( Attempt shell expansion on the current word. ) tindex(list-choices) -item(tt(list-choices) (ESC-^D) (^D =) (^D))( +item(tt(list-choices) (tt(ESC-^D)) (tt(^D =)) (tt(^D)))( List possible completions for the current word. ) tindex(list-expand) -item(tt(list-expand) (^Xg ^XG) (^G) (^G))( +item(tt(list-expand) (tt(^Xg ^XG)) (tt(^G)) (tt(^G)))( List the expansion of the current word. ) tindex(magic-space) @@ -2015,7 +2015,7 @@ texinode(Miscellaneous)(Text Objects)(Completion)(Zle Widgets) subsect(Miscellaneous) startitem() tindex(accept-and-hold) -item(tt(accept-and-hold) (ESC-A ESC-a) (unbound) (unbound))( +item(tt(accept-and-hold) (tt(ESC-A ESC-a)) (unbound) (unbound))( Push the contents of the buffer on the buffer stack and execute it. ) @@ -2026,12 +2026,12 @@ Then search the history list for a line matching the current one and push the event following onto the buffer stack. ) tindex(accept-line) -item(tt(accept-line) (^J ^M) (^J ^M) (^J ^M))( +item(tt(accept-line) (tt(^J ^M)) (tt(^J ^M)) (tt(^J ^M)))( Finish editing the buffer. Normally this causes the buffer to be executed as a shell command. ) tindex(accept-line-and-down-history) -item(tt(accept-line-and-down-history) (^O) (unbound) (unbound))( +item(tt(accept-line-and-down-history) (tt(^O)) (unbound) (unbound))( Execute the current line, and push the next history event on the buffer stack. ) @@ -2058,7 +2058,7 @@ item(tt(beep))( Beep, unless the tt(BEEP) option is unset. ) tindex(vi-cmd-mode) -item(tt(vi-cmd-mode) (^X^V) (unbound) (^[))( +item(tt(vi-cmd-mode) (tt(^X^V)) (unbound) (tt(^[)))( Enter command mode; that is, select the `tt(vicmd)' keymap. Yes, this is bound by default in emacs mode. ) @@ -2069,7 +2069,7 @@ This is for vi users without the mental capacity to keep track of their caps lock key (like the author). ) tindex(clear-screen) -item(tt(clear-screen) (^L ESC-^L) (^L) (^L))( +item(tt(clear-screen) (tt(^L ESC-^L)) (tt(^L)) (tt(^L)))( Clear the screen and redraw the prompt. ) tindex(describe-key-briefly) @@ -2077,7 +2077,7 @@ item(tt(describe-key-briefly))( Reads a key sequence, then prints the function bound to that sequence. ) tindex(exchange-point-and-mark) -item(tt(exchange-point-and-mark) (^X^X) (unbound) (unbound))( +item(tt(exchange-point-and-mark) (tt(^X^X)) (unbound) (unbound))( Exchange the cursor position (point) with the position of the mark. Unless a negative numeric argument is given, the region between point and mark is activated so that it can be highlighted. @@ -2085,7 +2085,7 @@ If a zero numeric argument is given, the region is activated but point and mark are not swapped. ) tindex(execute-named-cmd) -item(tt(execute-named-cmd) (ESC-x) (:) (unbound))( +item(tt(execute-named-cmd) (tt(ESC-x)) (tt(:)) (unbound))( Read the name of an editor command and execute it. A restricted set of editing functions is available in the mini-buffer. Keys are looked up in the special @@ -2125,18 +2125,18 @@ The bindings of the current insert mode will be used. Currently this command may not be redefined or called by name. ) tindex(execute-last-named-cmd) -item(tt(execute-last-named-cmd) (ESC-z) (unbound) (unbound))( +item(tt(execute-last-named-cmd) (tt(ESC-z)) (unbound) (unbound))( Redo the last function executed with tt(execute-named-cmd). Currently this command may not be redefined or called by name. ) tindex(get-line) -item(tt(get-line) (ESC-G ESC-g) (unbound) (unbound))( +item(tt(get-line) (tt(ESC-G ESC-g)) (unbound) (unbound))( Pop the top line off the buffer stack and insert it at the cursor position. ) tindex(pound-insert) -item(tt(pound-insert) (unbound) (#) (unbound))( +item(tt(pound-insert) (unbound) (tt(#)) (unbound))( If there is no # character at the beginning of the buffer, add one to the beginning of each line. If there is one, remove a # from each line that has one. @@ -2162,7 +2162,7 @@ construct will be popped off the top of the buffer stack and loaded into the editing buffer. ) tindex(push-line) -item(tt(push-line) (^Q ESC-Q ESC-q) (unbound) (unbound))( +item(tt(push-line) (tt(^Q ESC-Q ESC-q)) (unbound) (unbound))( Push the current buffer onto the buffer stack and clear the buffer. Next time the editor starts up, the buffer will be popped @@ -2229,7 +2229,7 @@ recursive edit is detected as a non-zero return status and propagated by using the tt(send-break) widget. ) tindex(redisplay) -item(tt(redisplay) (unbound) (^R) (^R))( +item(tt(redisplay) (unbound) (tt(^R)) (tt(^R)))( Redisplays the edit buffer. ) tindex(reset-prompt) @@ -2247,7 +2247,7 @@ shell (such as a job notification) which causes the command line to be reprinted. ) tindex(send-break) -item(tt(send-break) (^G ESC-^G) (unbound) (unbound))( +item(tt(send-break) (tt(^G ESC-^G)) (unbound) (unbound))( Abort the current editor function, e.g. tt(execute-named-command), or the editor itself, e.g. if you are in tt(vared). Otherwise abort the parsing of the current line; in this case the aborted line is available in the shell @@ -2255,13 +2255,13 @@ variable tt(ZLE_LINE_ABORTED). If the editor is aborted from within tt(vared), the variable tt(ZLE_VARED_ABORTED) is set. ) tindex(run-help) -item(tt(run-help) (ESC-H ESC-h) (unbound) (unbound))( +item(tt(run-help) (tt(ESC-H ESC-h)) (unbound) (unbound))( Push the buffer onto the buffer stack, and execute the command `tt(run-help) var(cmd)', where var(cmd) is the current command. tt(run-help) is normally aliased to tt(man). ) tindex(vi-set-buffer) -item(tt(vi-set-buffer) (unbound) (") (unbound))( +item(tt(vi-set-buffer) (unbound) (tt(")) (unbound))( Specify a buffer to be used in the following command. There are 37 buffers that can be specified: the 26 `named' buffers tt("a) to tt("z), the `yank' buffer tt("0), @@ -2278,7 +2278,7 @@ affecting the normal registers. If no buffer is specified for a cut or change command, tt("1) is used, and the contents of tt("1) to tt("8) are each shifted along one buffer; the contents of tt("9) is lost. If no buffer is specified for a yank -command, tt("0") is used. Finally, a paste command without a specified +command, tt("0) is used. Finally, a paste command without a specified buffer will paste the text from the most recent command regardless of any buffer that might have been used with that command. @@ -2288,18 +2288,18 @@ can optionally be specified with an argument. For example, example(zle vi-set-buffer A) ) tindex(vi-set-mark) -item(tt(vi-set-mark) (unbound) (m) (unbound))( +item(tt(vi-set-mark) (unbound) (tt(m)) (unbound))( Set the specified mark at the cursor position. ) tindex(set-mark-command) -item(tt(set-mark-command) (^@) (unbound) (unbound))( +item(tt(set-mark-command) (tt(^@)) (unbound) (unbound))( Set the mark at the cursor position. If called with a negative numeric argument, do not set the mark but deactivate the region so that it is no longer highlighted (it is still usable for other purposes). Otherwise the region is marked as active. ) tindex(spell-word) -item(tt(spell-word) (ESC-$ ESC-S ESC-s) (unbound) (unbound))( +item(tt(spell-word) (tt(ESC-$ ESC-S ESC-s)) (unbound) (unbound))( Attempt spelling correction on the current word. ) tindex(split-undo) @@ -2315,7 +2315,7 @@ This command is executed when a key sequence that is not bound to any command is typed. By default it beeps. ) tindex(undo) -item(tt(undo) (^_ ^Xu ^X^U) (u) (unbound))( +item(tt(undo) (tt(^_ ^Xu ^X^U)) (tt(u)) (unbound))( Incrementally undo the last text modification. When called from a user-defined widget, takes an optional argument indicating a previous state of the undo history as returned by the tt(UNDO_CHANGE_NO) variable; @@ -2326,7 +2326,7 @@ insert mode is reverted, the changes having been merged when command mode was selected. ) tindex(redo) -item(tt(redo) (unbound) (^R) (unbound))( +item(tt(redo) (unbound) (tt(^R)) (unbound))( Incrementally redo undone text modifications. ) tindex(vi-undo-change) @@ -2335,21 +2335,21 @@ Undo the last text modification. If repeated, redo the modification. ) tindex(visual-mode) -item(tt(visual-mode) (unbound) (v) (unbound))( +item(tt(visual-mode) (unbound) (tt(v)) (unbound))( Toggle vim-style visual selection mode. If line-wise visual mode is currently enabled then it is changed to being character-wise. If used following an operator, it forces the subsequent movement command to be treated as a character-wise movement. ) tindex(visual-line-mode) -item(tt(visual-line-mode) (unbound) (V) (unbound))( +item(tt(visual-line-mode) (unbound) (tt(V)) (unbound))( Toggle vim-style line-wise visual selection mode. If character-wise visual mode is currently enabled then it is changed to being line-wise. If used following an operator, it forces the subsequent movement command to be treated as a line-wise movement. ) tindex(what-cursor-position) -item(tt(what-cursor-position) (^X=) (ga) (unbound))( +item(tt(what-cursor-position) (tt(^X=)) (tt(ga)) (unbound))( Print the character under the cursor, its code as an octal, decimal and hexadecimal number, the current cursor position within the buffer and the column of the cursor in the current line. @@ -2363,13 +2363,13 @@ mini-buffer. Keys are looked up in the special tt(command) keymap, and if not found there in the main keymap. ) tindex(which-command) -item(tt(which-command) (ESC-?) (unbound) (unbound))( +item(tt(which-command) (tt(ESC-?)) (unbound) (unbound))( Push the buffer onto the buffer stack, and execute the command `tt(which-command) var(cmd)'. where var(cmd) is the current -command. tt(which-command) is normally aliased to var(whence). +command. tt(which-command) is normally aliased to tt(whence). ) tindex(vi-digit-or-beginning-of-line) -item(tt(vi-digit-or-beginning-of-line) (unbound) (0) (unbound))( +item(tt(vi-digit-or-beginning-of-line) (unbound) (tt(0)) (unbound))( If the last command executed was a digit as part of an argument, continue the argument. Otherwise, execute vi-beginning-of-line. ) @@ -2386,34 +2386,34 @@ keymaps. startitem() tindex(select-a-blank-word) -item(tt(select-a-blank-word) (aW))( +item(tt(select-a-blank-word) (tt(aW)))( Select a word including adjacent blanks, where a word is defined as a series of non-blank characters. With a numeric argument, multiple words will be selected. ) tindex(select-a-shell-word) -item(tt(select-a-shell-word) (aa))( +item(tt(select-a-shell-word) (tt(aa)))( Select the current command argument applying the normal rules for quoting. ) tindex(select-a-word) -item(tt(select-a-word) (aw))( +item(tt(select-a-word) (tt(aw)))( Select a word including adjacent blanks, using the normal vi-style word definition. With a numeric argument, multiple words will be selected. ) tindex(select-in-blank-word) -item(tt(select-in-blank-word) (iW))( +item(tt(select-in-blank-word) (tt(iW)))( Select a word, where a word is defined as a series of non-blank characters. With a numeric argument, multiple words will be selected. ) tindex(select-in-shell-word) -item(tt(select-in-shell-word) (ia))( +item(tt(select-in-shell-word) (tt(ia)))( Select the current command argument applying the normal rules for quoting. If the argument begins and ends with matching quote characters, these are not included in the selection. ) tindex(select-in-word) -item(tt(select-in-word) (iw))( +item(tt(select-in-word) (tt(iw)))( Select a word, using the normal vi-style word definition. With a numeric argument, multiple words will be selected. ) diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 8702d2baa..4ec626fd3 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -48,7 +48,7 @@ def(enditem)(0)()\ def(item)(2)( ARG1: ARG2)\ def(nofill)(1)(ARG1)\ -def(uref)(1)(ARG1)\ +def(uref)(1)(url(ARG1)(ARG1))\ def(LPAR)(0)(CHAR(40))\ def(RPAR)(1)(CHAR(41)) myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2010/02/15) diff --git a/Functions/Chpwd/_cdr b/Functions/Chpwd/_cdr index 2f52ff54b..3a1e9bde8 100644 --- a/Functions/Chpwd/_cdr +++ b/Functions/Chpwd/_cdr @@ -5,7 +5,7 @@ integer default insert zstyle -t ':chpwd:' recent-dirs-default && default=1 if (( default )); then - zstyle -s ':completion:${curcontext}' recent-dirs-insert insert_string + zstyle -s ":completion:${curcontext}:" recent-dirs-insert insert_string case $insert_string in (both) insert=4 diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match index 9159f496c..d977983bf 100644 --- a/Functions/Zftp/zfcd_match +++ b/Functions/Zftp/zfcd_match @@ -25,7 +25,13 @@ if [[ $ZFTP_SYSTEM = UNIX* ]]; then fi # If we're using -F, we get away with using a directory # to list, but not a glob. Don't ask me why. - reply=(${${(M)${(f)"$(zftp ls -lF $dir)"}:#d*}/(#b)*[[:space:]](*)\//$match[1]}) + reply=(${(M)${(f)"$(zftp ls -lF $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##\/}) + + # If ls -lF doesn't work, try dir ... + if ! (($#reply)); then + reply=(${(M)${(f)"$(zftp dir $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##}) + fi + reply=(${reply/(#b)d([^[:space:]]##[[:space:]]##)(#c8)([^\/]##)\/#/$match[2]}) # () { # zftp ls -LF $dir >|$1 # reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $1)) diff --git a/Functions/Zftp/zfdir b/Functions/Zftp/zfdir index 4818dc973..5ec0ebf8c 100644 --- a/Functions/Zftp/zfdir +++ b/Functions/Zftp/zfdir @@ -62,7 +62,7 @@ for (( i = 1; i <= $#argv; i++ )); do fi done -if [[ $# -eq 0 ]]; then +if [[ $# -eq 0 && $redir -ne 1 ]]; then # Cache it in the current directory file. This means that repeated # calls to zfdir with no arguments always use a cached file. if [[ -z $curdir ]]; then @@ -79,11 +79,12 @@ else fi file=$otherdir newargs="$*" - if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then + if [[ -f $file && -n $newargs && $force -ne 1 ]]; then # Don't use the cached file if the arguments changed. + # Even in zfdir -r new_args ... [[ $newargs = $zfconfig[otherargs_$ZFTP_SESSION] ]] || rm -f $file fi - zfconfig[otherargs_$ZFTP_SESSION]=$newargs + [[ -n $newargs ]] && zfconfig[otherargs_$ZFTP_SESSION]=$newargs fi if [[ $force -eq 1 ]]; then diff --git a/Functions/Zle/select-bracketed b/Functions/Zle/select-bracketed new file mode 100644 index 000000000..00f51be2c --- /dev/null +++ b/Functions/Zle/select-bracketed @@ -0,0 +1,56 @@ +# Text object for matching characters between matching pairs of brackets +# +# So for example, given (( i+1 )), the vi command ci( will change +# all the text between matching colons. +# +# The following is an example of how to enable this: +# autoload -U select-bracketed +# zle -N select-bracketed +# for m in visual viopp; do +# for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do +# bindkey -M $m $c select-bracketed +# done +# done + +local style=${${1:-$KEYS}[1]} matching="(){}[]<>bbBB" +local -i find=${NUMERIC:-1} idx=${matching[(I)[${${1:-$KEYS}[2]}]]}%9 +(( idx )) || return 1 # no corresponding closing bracket +local lmatch=${matching[1 + (idx-1) & ~1]} +local rmatch=${matching[1 + (idx-1) | 1]} +local -i start=CURSOR+1 end=CURSOR+1 rfind=find + +[[ $BUFFER[start] = "$rmatch" ]] && (( start--, end-- )) +if (( REGION_ACTIVE && MARK != CURSOR)); then + (( MARK < CURSOR && (start=end=MARK+1) )) + local -i origstart=start-1 + [[ $style = i ]] && (( origstart-- )) +fi + +while (( find )); do + for (( ; find && start; --start )); do + case $BUFFER[start] in + "$lmatch") (( find-- )) ;; + "$rmatch") (( find++ )) ;; + esac + done + + (( find )) && return 1 # opening bracket not found + + while (( rfind && end++ < $#BUFFER )); do + case $BUFFER[end] in + "$lmatch") (( rfind++ )) ;; + "$rmatch") (( rfind-- )) ;; + esac + done + + (( rfind )) && return 1 # closing bracket not found + + (( REGION_ACTIVE && MARK != CURSOR && start >= origstart && + ( find=rfind=${NUMERIC:-1} ) )) +done + +[[ $style = i ]] && (( start++, end-- )) +(( REGION_ACTIVE = !!REGION_ACTIVE )) +[[ $KEYMAP = vicmd ]] && (( REGION_ACTIVE && end-- )) +MARK=$start +CURSOR=$end diff --git a/Functions/Zle/select-quoted b/Functions/Zle/select-quoted new file mode 100644 index 000000000..904f1e46d --- /dev/null +++ b/Functions/Zle/select-quoted @@ -0,0 +1,71 @@ +# Text object for matching characters between a particular delimiter +# +# So for example, given "text", the vi command vi" will select +# all the text between the double quotes +# +# The following is an example of how to enable this: +# autoload -U select-quoted +# zle -N select-quoted +# for m in visual viopp; do +# for c in {a,i}{\',\",\`}; do +# bindkey -M $m $c select-quoted +# done +# done + +setopt localoptions noksharrays + +local matching=${${1:-$KEYS}[2]} +local -i start=CURSOR+2 end=CURSOR+2 found=0 alt=0 count=0 + +if ((REGION_ACTIVE )); then + if (( MARK < CURSOR )); then + start=MARK+2 + else + end=MARK+2 + fi +fi + +[[ $BUFFER[CURSOR+1] = $matching && $BUFFER[CURSOR] != \\ ]] && count=1 +while (( (count || ! alt) && --start )) && [[ $BUFFER[start] != $'\n' ]]; do + if [[ $BUFFER[start] = "$matching" ]]; then + if [[ $BUFFER[start-1] = \\ ]]; then + (( start-- )) + elif (( ! found )); then + found=start + else + (( ! alt )) && alt=start + (( count && ++count )) + fi + fi +done + +for (( start=CURSOR+2; ! found && start+1 < $#BUFFER; start++ )); do + case $BUFFER[start] in + $'\n') return 1 ;; + \\) (( start++ )) ;; + "$matching") + (( end=start+1, found=start )) + ;; + esac +done + +[[ $BUFFER[end-1] = \\ ]] && (( end++ )) +until [[ $BUFFER[end] == "$matching" ]]; do + [[ $BUFFER[end] = \\ ]] && (( end++ )) + if [[ $BUFFER[end] = $'\n' ]] || (( ++end > $#BUFFER )); then + end=0 + break + fi +done + +if (( alt && (!end || count == 2) )); then + end=found + found=alt +fi +(( end )) || return 1 + +[[ ${${1:-$KEYS}[1]} = a ]] && (( found-- )) || (( end-- )) +(( REGION_ACTIVE = !!REGION_ACTIVE )) +[[ $KEYMAP = vicmd ]] && (( REGION_ACTIVE && end-- )) +MARK=found +CURSOR=end diff --git a/Functions/Zle/surround b/Functions/Zle/surround new file mode 100644 index 000000000..b7be30b75 --- /dev/null +++ b/Functions/Zle/surround @@ -0,0 +1,75 @@ +# Implementation of some functionality of the popular vim surround plugin. +# Allows "surroundings" to be changes: parentheses, brackets and quotes. + +# To use +# autoload -Uz surround +# zle -N delete-surround surround +# zle -N add-surround surround +# zle -N change-surround surround +# bindkey -a cs change-surround +# bindkey -a ds delete-surround +# bindkey -a ys add-surround +# bindkey -M visual S add-surround +# +# This doesn't allow yss to operate on a line but VS will work + +setopt localoptions noksharrays +autoload -Uz select-quoted select-bracketed +local before after +local -A matching +matching=( \( \) \{ \} \< \> \[ \] ) + +case $WIDGET in + change-*) + local MARK="$MARK" CURSOR="$CURSOR" call + read -k 1 before + if [[ ${(kvj::)matching} = *$before* ]]; then + call=select-bracketed + else + call=select-quoted + fi + read -k 1 after + $call "a$before" || return 1 + before="$after" + if [[ -n $matching[$before] ]]; then + after=" $matching[$before]" + before+=' ' + elif [[ -n $matching[(r)[$before:q]] ]]; then + before="${(k)matching[(r)[$before:q]]}" + fi + BUFFER[CURSOR]="$after" + BUFFER[MARK+1]="$before" + CURSOR=MARK + ;; + delete-*) + local MARK="$MARK" CURSOR="$CURSOR" call + read -k 1 before + if [[ ${(kvj::)matching} = *$before* ]]; then + call=select-bracketed + else + call=select-quoted + fi + if $call "a$before"; then + BUFFER[CURSOR]='' + BUFFER[MARK+1]='' + CURSOR=MARK + fi + ;; + add-*) + local save_cut="$CUTBUFFER" + zle .vi-change || return + local save_cur="$CURSOR" + zle .vi-cmd-mode + read -k 1 before + after="$before" + if [[ -n $matching[$before] ]]; then + after=" $matching[$before]" + before+=' ' + elif [[ -n $matching[(r)[$before:q]] ]]; then + before="${(k)matching[(r)[$before:q]]}" + fi + CUTBUFFER="$before$CUTBUFFER$after" + zle .vi-put-after -n 1 + CUTBUFFER="$save_cut" CURSOR="$save_cur" + ;; +esac @@ -24,6 +24,22 @@ Changes from 5.0.7 to 5.0.8 as a reference to a variable, e.g. ${(ps.$sep.)foo} to split $foo on a string given by $sep. +- The option FORCE_FLOAT now forces variables, not just constants, + to floating point in arithmetic expressions. + +- The type of an assignment in arithmetic expressions, e.g. the + type seen by the variable res in $(( res = a = b )), is now + more logical and C-like. + +- The default binding of 'u' in vi command mode has changed to undo + multiple changes when invoked repeatedly. '^R' is now bound to redo + changes. To revert to toggling of the last edit use: + bindkey -a u vi-undo-change + +- Compatibility with Vim has been improved for vi editing mode. Most + notably, Vim style text objects are supported and the region can be + manipulated with vi commands in the same manner as Vim's visual mode. + - Elements of the watch variable may now be patterns. - The logic for retrying history locking has been improved. @@ -117,6 +117,12 @@ New behaviour: 0.5 +4) The _git completion used to offer both local and remote heads under the +tag 'heads'. The tag has now been split into 'heads-local' and +'heads-remote' in all contexts that existed in 5.0.7. The --fixup/--squash +context still uses the tag 'heads' (but this may change in a future release). + + Incompatibilities between 5.0.2 and 5.0.5 ----------------------------------------- diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index c89495070..376cd8402 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -914,6 +914,9 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) { char **ap, *cp; int nbc = 0, colon = 0, pre = 0, suf = 0; +#ifdef MULTIBYTE_SUPPORT + int prechars = 0; +#endif /* MULTIBYTE_SUPPORT */ for (ap = args + 2; *ap; ap++) { for (nbc = 0, cp = *ap; *cp && *cp != ':'; cp++) @@ -921,10 +924,23 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) cp++, nbc++; if (*cp == ':' && cp[1]) { int d; +#ifdef MULTIBYTE_SUPPORT + int dchars = 0; +#endif /* MULTIBYTE_SUPPORT */ colon++; if ((d = cp - *ap - nbc) > pre) pre = d; +#ifdef MULTIBYTE_SUPPORT + if (isset(MULTIBYTE)) { + *cp = '\0'; + dchars = MB_METASTRWIDTH(*ap) - nbc; + *cp = ':'; + } else + dchars = d; + if (dchars > prechars) + prechars = dchars; +#endif /* MULTIBYTE_SUPPORT */ if ((d = strlen(cp + 1)) > suf) suf = d; } @@ -937,8 +953,10 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) ret = (char **) zalloc((arrlen(args + 2) + 1) * sizeof(char *)); +#ifndef MULTIBYTE_SUPPORT memcpy(buf + pre, args[1], sl); suf = pre + sl; +#endif /* MULTIBYTE_SUPPORT */ for (rp = ret, ap = args + 2; *ap; ap++) { copy = dupstring(*ap); @@ -950,9 +968,27 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) oldc = *cpp; *cpp = '\0'; if (((cpp == cp && oldc == ':') || *cp == ':') && cp[1]) { +#ifdef MULTIBYTE_SUPPORT + int rempad; + char *ptr; + memcpy(buf, copy, (cpp - copy)); + *cp = '\0'; + if (isset(MULTIBYTE)) + rempad = prechars - MB_METASTRWIDTH(copy); + else + rempad = prechars - strlen(copy); + ptr = buf + (cpp - copy); + if (rempad) + memset(ptr, ' ', rempad); + ptr += rempad; + memcpy(ptr, args[1], sl); + ptr += sl; + strcpy(ptr, cp + 1); +#else /* MULTIBYTE_SUPPORT */ memset(buf, ' ', pre); memcpy(buf, copy, (cpp - copy)); strcpy(buf + suf, cp + 1); +#endif /* MULTIBYTE_SUPPORT */ *rp++ = ztrdup(buf); } else *rp++ = ztrdup(copy); diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 000f9da2a..d4051bda0 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -2996,9 +2996,9 @@ mod_export void begcmgroup(char *n, int flags) { if (n) { - Cmgroup p = amatches; - - while (p) { + /* If a group named <n> already exists, reuse it. */ + Cmgroup p; + for (p = amatches; p; p = p->next) { #ifdef ZSH_HEAP_DEBUG if (memory_validate(p->heap_id)) { HEAP_ERROR(p->heap_id); @@ -3016,9 +3016,10 @@ begcmgroup(char *n, int flags) return; } - p = p->next; } } + + /* Create a new group. */ mgroup = (Cmgroup) zhalloc(sizeof(struct cmgroup)); #ifdef ZSH_HEAP_DEBUG mgroup->heap_id = last_heap_id; diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index a81d1ddad..27938c17f 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -210,6 +210,25 @@ cd_calc() } } +/* Return 1 if cd_state specifies unsorted groups, 0 otherwise. */ +static int +cd_groups_want_sorting(void) +{ + Cdset set; + char *const *i; + + for (set = cd_state.sets; set; set = set->next) + for (i = set->opts; *i; i++) { + if (!strncmp(*i, "-V", 2)) + return 0; + else if (!strncmp(*i, "-J", 2)) + return 1; + } + + /* Sorted by default */ + return 1; +} + static int cd_sort(const void *a, const void *b) { @@ -283,7 +302,8 @@ cd_prep() unmetafy(s->sortstr, &dummy); } - qsort(grps, preplines, sizeof(Cdstr), cd_sort); + if (cd_groups_want_sorting()) + qsort(grps, preplines, sizeof(Cdstr), cd_sort); for (i = preplines, strp = grps; i > 1; i--, strp++) { strp2 = strp + 1; @@ -441,7 +461,17 @@ cd_arrcat(char **a, char **b) } } -/* Initialisation. Store and calculate the string and matches and so on. */ +/* Initialisation. Store and calculate the string and matches and so on. + * + * nam: argv[0] of the builtin + * hide: ??? + * mlen: see max-matches-width style + * sep: see list-seperator style + * opts: options to (eventually) pass to compadd. + * Returned via 2nd return parameter of 'compdescribe -g'. + * args: ??? (the positional arguments to 'compdescribe') + * disp: 1 if descriptions should be shown, 0 otherwise + */ static int cd_init(char *nam, char *hide, char *mlen, char *sep, @@ -699,8 +729,12 @@ cd_get(char **params) dpys[0] = ztrdup(run->strs->str); mats[1] = dpys[1] = NULL; opts = cd_arrdup(run->strs->set->opts); + + /* Set -2V, possibly reusing the group name from an existing -J/-V + * flag. */ for (dp = opts + 1; *dp; dp++) - if (dp[0][0] == '-' && dp[0][1] == 'J') + if ((dp[0][0] == '-' && dp[0][1] == 'J') || + (dp[0][0] == '-' && dp[0][1] == 'V')) break; if (*dp) { char *s = tricat("-2V", "", dp[0] + 2); diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c index dc5fed4ce..ce4b0724d 100644 --- a/Src/Zle/zle_params.c +++ b/Src/Zle/zle_params.c @@ -173,7 +173,7 @@ makezleparams(int ro) pm->base = 10; break; } - if ((zp->type & PM_UNSET) && (zmod.flags & MOD_MULT)) + if ((zp->type & PM_UNSET) && (zmod.flags & (MOD_MULT|MOD_TMULT))) pm->node.flags &= ~PM_UNSET; } } diff --git a/Src/builtin.c b/Src/builtin.c index ffde5c916..a9afb4540 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -122,9 +122,9 @@ static struct builtin builtins[] = BUILTIN("type", 0, bin_whence, 0, -1, 0, "ampfsSw", "v"), BUILTIN("typeset", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klprtuxmz", NULL), BUILTIN("umask", 0, bin_umask, 0, 1, 0, "S", NULL), - BUILTIN("unalias", 0, bin_unhash, 1, -1, 0, "ms", "a"), - BUILTIN("unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"), - BUILTIN("unhash", 0, bin_unhash, 1, -1, 0, "adfms", NULL), + BUILTIN("unalias", 0, bin_unhash, 0, -1, BIN_UNALIAS, "ams", NULL), + BUILTIN("unfunction", 0, bin_unhash, 1, -1, BIN_UNFUNCTION, "m", "f"), + BUILTIN("unhash", 0, bin_unhash, 1, -1, BIN_UNHASH, "adfms", NULL), BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "fmv", NULL), BUILTIN("unsetopt", 0, bin_setopt, 0, -1, BIN_UNSETOPT, NULL, NULL), BUILTIN("wait", 0, bin_fg, 0, -1, BIN_WAIT, NULL, NULL), @@ -2344,7 +2344,12 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func), pm->gsu.s->setfn(pm, ztrdup("")); break; case PM_INTEGER: - pm->gsu.i->setfn(pm, 0); + /* + * Restricted integers are dangerous to initialize to 0, + * so don't do that. + */ + if (!(pm->old->node.flags & PM_RESTRICTED)) + pm->gsu.i->setfn(pm, 0); break; case PM_EFLOAT: case PM_FFLOAT: @@ -3552,26 +3557,54 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func)) /**/ int -bin_unhash(char *name, char **argv, Options ops, UNUSED(int func)) +bin_unhash(char *name, char **argv, Options ops, int func) { HashTable ht; HashNode hn, nhn; Patprog pprog; - int match = 0, returnval = 0; + int match = 0, returnval = 0, all = 0; int i; /* Check which hash table we are working with. */ - if (OPT_ISSET(ops,'d')) + if (func == BIN_UNALIAS) { + if (OPT_ISSET(ops,'s')) + ht = sufaliastab; /* suffix aliases */ + else + ht = aliastab; /* aliases */ + if (OPT_ISSET(ops, 'a')) { + if (*argv) { + zwarnnam(name, "-a: too many arguments"); + return 1; + } + all = 1; + } else if (!*argv) { + zwarnnam(name, "not enough arguments"); + return 1; + } + } else if (OPT_ISSET(ops,'d')) ht = nameddirtab; /* named directories */ else if (OPT_ISSET(ops,'f')) ht = shfunctab; /* shell functions */ else if (OPT_ISSET(ops,'s')) ht = sufaliastab; /* suffix aliases, must precede aliases */ - else if (OPT_ISSET(ops,'a')) + else if (func == BIN_UNHASH && (OPT_ISSET(ops,'a'))) ht = aliastab; /* aliases */ else ht = cmdnamtab; /* external commands */ + if (all) { + queue_signals(); + for (i = 0; i < ht->hsize; i++) { + for (hn = ht->nodes[i]; hn; hn = nhn) { + /* record pointer to next, since we may free this one */ + nhn = hn->next; + ht->freenode(ht->removenode(ht, hn->nam)); + } + } + unqueue_signals(); + return 0; + } + /* With -m option, treat arguments as glob patterns. * * "unhash -m '*'" is legal, but not recommended. */ if (OPT_ISSET(ops,'m')) { @@ -3765,9 +3798,9 @@ bin_print(char *name, char **args, Options ops, int func) { int flen, width, prec, type, argc, n, narg, curlen = 0; int nnl = 0, fmttrunc = 0, ret = 0, maxarg = 0, nc = 0; - int flags[5], *len; - char *start, *endptr, *c, *d, *flag, *buf = NULL, spec[13], *fmt = NULL; - char **first, **argp, *curarg, *flagch = "0+- #", save = '\0', nullstr = '\0'; + int flags[6], *len; + char *start, *endptr, *c, *d, *flag, *buf = NULL, spec[14], *fmt = NULL; + char **first, **argp, *curarg, *flagch = "'0+- #", save = '\0', nullstr = '\0'; size_t rcount, count = 0; #ifdef HAVE_OPEN_MEMSTREAM size_t mcount; @@ -4788,6 +4821,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun mod_export int exit_pending; +/* Shell level at which we exit if exit_pending */ +/**/ +mod_export int +exit_level; + /* break, bye, continue, exit, logout, return -- most of these take * * one numeric argument, and the other (logout) is related to return. * * (return is treated as a logout when in a login shell.) */ @@ -4865,6 +4903,7 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func) retflag = 1; breaks = loops; exit_pending = (num << 1) | 1; + exit_level = locallevel; } } else zexit(num, 0); diff --git a/Src/exec.c b/Src/exec.c index 6a8b35a36..527d61197 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5101,7 +5101,15 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) } popheap(); - if (exit_pending) { + /* + * Exit with a tidy up. + * Only leave if we're at the end of the appropriate function --- + * not a nested function. As we usually skip the function body, + * the only likely case where we need that second test is + * when we have an "always" block. The endparamscope() has + * already happened, hence the "+1" here. + */ + if (exit_pending && exit_level >= locallevel+1) { if (locallevel > forklevel) { /* Still functions to return: force them to do so. */ retflag = 1; diff --git a/Src/hashtable.h b/Src/hashtable.h index 131c15c7b..b6346bb9a 100644 --- a/Src/hashtable.h +++ b/Src/hashtable.h @@ -59,6 +59,9 @@ #define BIN_ENABLE 25 #define BIN_PRINTF 26 #define BIN_COMMAND 27 +#define BIN_UNHASH 28 +#define BIN_UNALIAS 29 +#define BIN_UNFUNCTION 30 /* These currently depend on being 0 and 1. */ #define BIN_SETOPT 0 @@ -1345,8 +1345,13 @@ gettokstr(int c, int sub) break; } brk: - if (errflag) + if (errflag) { + if (in_brace_param) { + while(bct-- >= in_brace_param) + cmdpop(); + } return LEXERR; + } hungetc(c); if (unmatched) zerr("unmatched %c", unmatched); diff --git a/Src/loop.c b/Src/loop.c index d025fbb9f..e4e8e2df8 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -545,7 +545,7 @@ execcase(Estate state, int do_exec) Wordcode end, next; wordcode code = state->pc[-1]; char *word, *pat; - int npat, save; + int npat, save, nalts, ialt, patok; Patprog *spprog, pprog; end = state->pc + WC_CASE_SKIP(code); @@ -561,60 +561,74 @@ execcase(Estate state, int do_exec) if (wc_code(code) != WC_CASE) break; - pat = NULL; - pprog = NULL; save = 0; - npat = state->pc[1]; - spprog = state->prog->pats + npat; - next = state->pc + WC_CASE_SKIP(code); + nalts = *state->pc++; + ialt = patok = 0; if (isset(XTRACE)) { - char *opat; - - pat = dupstring(opat = ecrawstr(state->prog, state->pc, NULL)); - singsub(&pat); - save = (!(state->prog->flags & EF_HEAP) && - !strcmp(pat, opat) && *spprog != dummy_patprog2); - printprompt4(); fprintf(xtrerr, "case %s (", word); - quote_tokenized_output(pat, xtrerr); - fprintf(xtrerr, ")\n"); - fflush(xtrerr); } - state->pc += 2; - if (*spprog != dummy_patprog1 && *spprog != dummy_patprog2) - pprog = *spprog; - - if (!pprog) { - if (!pat) { - char *opat; + while (!patok && nalts) { + npat = state->pc[1]; + spprog = state->prog->pats + npat; + pprog = NULL; + pat = NULL; + + if (isset(XTRACE)) { int htok = 0; - - pat = dupstring(opat = ecrawstr(state->prog, - state->pc - 2, &htok)); + pat = dupstring(ecrawstr(state->prog, state->pc, &htok)); if (htok) singsub(&pat); - save = (!(state->prog->flags & EF_HEAP) && - !strcmp(pat, opat) && *spprog != dummy_patprog2); + + if (ialt++) + fprintf(stderr, " | "); + quote_tokenized_output(pat, xtrerr); } - if (!(pprog = patcompile(pat, (save ? PAT_ZDUP : PAT_STATIC), - NULL))) - zerr("bad pattern: %s", pat); - else if (save) - *spprog = pprog; + + if (*spprog != dummy_patprog1 && *spprog != dummy_patprog2) + pprog = *spprog; + + if (!pprog) { + if (!pat) { + char *opat; + int htok = 0; + + pat = dupstring(opat = ecrawstr(state->prog, + state->pc, &htok)); + if (htok) + singsub(&pat); + save = (!(state->prog->flags & EF_HEAP) && + !strcmp(pat, opat) && *spprog != dummy_patprog2); + } + if (!(pprog = patcompile(pat, (save ? PAT_ZDUP : PAT_STATIC), + NULL))) + zerr("bad pattern: %s", pat); + else if (save) + *spprog = pprog; + } + if (pprog && pattry(pprog, word)) + patok = 1; + state->pc += 2; + nalts--; + } + state->pc += 2 * nalts; + if (isset(XTRACE)) { + fprintf(xtrerr, ")\n"); + fflush(xtrerr); } - if (pprog && pattry(pprog, word)) { + if (patok) { execlist(state, 1, ((WC_CASE_TYPE(code) == WC_CASE_OR) && do_exec)); while (!retflag && wc_code(code) == WC_CASE && WC_CASE_TYPE(code) == WC_CASE_AND) { state->pc = next; - code = *state->pc; - state->pc += 3; - next = state->pc + WC_CASE_SKIP(code) - 2; + code = *state->pc++; + next = state->pc + WC_CASE_SKIP(code); + nalts = *state->pc++; + state->pc += 2 * nalts; execlist(state, 1, ((WC_CASE_TYPE(code) == WC_CASE_OR) && do_exec)); } diff --git a/Src/params.c b/Src/params.c index d53b6ca7e..98541a6da 100644 --- a/Src/params.c +++ b/Src/params.c @@ -4580,17 +4580,21 @@ addenv(Param pm, char *value) static char * mkenvstr(char *name, char *value, int flags) { - char *str, *s; - int len_name, len_value; + char *str, *s = value; + int len_name, len_value = 0; len_name = strlen(name); - for (len_value = 0, s = value; - *s && (*s++ != Meta || *s++ != 32); len_value++); + if (s) + while (*s && (*s++ != Meta || *s++ != 32)) + len_value++; s = str = (char *) zalloc(len_name + len_value + 2); strcpy(s, name); s += len_name; *s = '='; - copyenvstr(s, value, flags); + if (value) + copyenvstr(s, value, flags); + else + *++s = '\0'; return str; } @@ -5032,67 +5036,11 @@ static const struct paramtypes pmtypes[] = { #define PMTYPES_SIZE ((int)(sizeof(pmtypes)/sizeof(struct paramtypes))) -/**/ -mod_export void -printparamnode(HashNode hn, int printflags) +static void +printparamvalue(Param p, int printflags) { - Param p = (Param) hn; char *t, **u; - if (p->node.flags & PM_UNSET) - return; - - if (printflags & PRINT_TYPESET) - printf("typeset "); - - /* Print the attributes of the parameter */ - if (printflags & (PRINT_TYPE|PRINT_TYPESET)) { - int doneminus = 0, i; - const struct paramtypes *pmptr; - - for (pmptr = pmtypes, i = 0; i < PMTYPES_SIZE; i++, pmptr++) { - int doprint = 0; - if (pmptr->flags & PMTF_TEST_LEVEL) { - if (p->level) - doprint = 1; - } else if (p->node.flags & pmptr->binflag) - doprint = 1; - - if (doprint) { - if (printflags & PRINT_TYPESET) { - if (pmptr->typeflag) { - if (!doneminus) { - putchar('-'); - doneminus = 1; - } - putchar(pmptr->typeflag); - } - } else { - printf("%s ", pmptr->string); - } - if ((pmptr->flags & PMTF_USE_BASE) && p->base) { - printf("%d ", p->base); - doneminus = 0; - } - if ((pmptr->flags & PMTF_USE_WIDTH) && p->width) { - printf("%d ", p->width); - doneminus = 0; - } - } - } - if (doneminus) - putchar(' '); - } - - if ((printflags & PRINT_NAMEONLY) || - ((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) { - zputs(p->node.nam, stdout); - putchar('\n'); - return; - } - - quotedzputs(p->node.nam, stdout); - if (p->node.flags & PM_AUTOLOAD) { putchar('\n'); return; @@ -5101,7 +5049,7 @@ printparamnode(HashNode hn, int printflags) putchar(' '); else if ((printflags & PRINT_TYPESET) && (PM_TYPE(p->node.flags) == PM_ARRAY || PM_TYPE(p->node.flags) == PM_HASHED)) - printf("\n%s=", p->node.nam); + printf("%s=", p->node.nam); else putchar('='); @@ -5160,3 +5108,108 @@ printparamnode(HashNode hn, int printflags) else putchar('\n'); } + +/**/ +mod_export void +printparamnode(HashNode hn, int printflags) +{ + Param p = (Param) hn; + int array_typeset; + + if (p->node.flags & PM_UNSET) { + if (isset(POSIXBUILTINS) && (p->node.flags & PM_READONLY) && + (printflags & PRINT_TYPESET)) + { + /* + * Special POSIX rules: show the parameter as readonly + * even though it's unset, but with no value. + */ + printflags |= PRINT_NAMEONLY; + } + else + return; + } + + if (printflags & PRINT_TYPESET) { + if ((p->node.flags & (PM_READONLY|PM_SPECIAL)) == + (PM_READONLY|PM_SPECIAL)) { + /* + * It's not possible to restore the state of + * these, so don't output. + */ + return; + } + /* + * Printing the value of array: this needs to be on + * a separate line so more care is required. + */ + array_typeset = (PM_TYPE(p->node.flags) == PM_ARRAY || + PM_TYPE(p->node.flags) == PM_HASHED) && + !(printflags & PRINT_NAMEONLY); + if (array_typeset && (p->node.flags & PM_READONLY)) { + /* + * We need to create the array before making it + * readonly. + */ + printf("typeset -a "); + zputs(p->node.nam, stdout); + putchar('\n'); + printparamvalue(p, printflags); + printflags |= PRINT_NAMEONLY; + } + printf("typeset "); + } + else + array_typeset = 0; + + /* Print the attributes of the parameter */ + if (printflags & (PRINT_TYPE|PRINT_TYPESET)) { + int doneminus = 0, i; + const struct paramtypes *pmptr; + + for (pmptr = pmtypes, i = 0; i < PMTYPES_SIZE; i++, pmptr++) { + int doprint = 0; + if (pmptr->flags & PMTF_TEST_LEVEL) { + if (p->level) + doprint = 1; + } else if (p->node.flags & pmptr->binflag) + doprint = 1; + + if (doprint) { + if (printflags & PRINT_TYPESET) { + if (pmptr->typeflag) { + if (!doneminus) { + putchar('-'); + doneminus = 1; + } + putchar(pmptr->typeflag); + } + } else { + printf("%s ", pmptr->string); + } + if ((pmptr->flags & PMTF_USE_BASE) && p->base) { + printf("%d ", p->base); + doneminus = 0; + } + if ((pmptr->flags & PMTF_USE_WIDTH) && p->width) { + printf("%d ", p->width); + doneminus = 0; + } + } + } + if (doneminus) + putchar(' '); + } + + if ((printflags & PRINT_NAMEONLY) || + ((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) { + zputs(p->node.nam, stdout); + putchar('\n'); + } else { + quotedzputs(p->node.nam, stdout); + + if (array_typeset) + putchar('\n'); + printparamvalue(p, printflags); + } +} diff --git a/Src/parse.c b/Src/parse.c index 985eb8e71..06cea744e 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -349,9 +349,8 @@ ecadd(wordcode c) eclen += a; } ecbuf[ecused] = c; - ecused++; - return ecused - 1; + return ecused++; } /* Delete a wordcode. */ @@ -1128,7 +1127,7 @@ par_for(int *cmplx) static void par_case(int *cmplx) { - int oecused = ecused, brflag, p, pp, n = 1, type; + int oecused = ecused, brflag, p, pp, palts, type, nalts; int ona, onc; p = ecadd(0); @@ -1173,36 +1172,69 @@ par_case(int *cmplx) if (!strcmp(tokstr, "esac")) break; str = dupstring(tokstr); + type = WC_CASE_OR; + pp = ecadd(0); + palts = ecadd(0); + nalts = 0; + /* + * Hack here. + * + * [Pause for astonished hubbub to subside.] + * + * The next token we get may be + * - ")" or "|" if we're looking at an honest-to-god + * "case" pattern, either because there's no opening + * parenthesis, or because SH_GLOB is set and we + * managed to grab an initial "(" to mark the start + * of the case pattern. + * - Something else --- we don't care what --- because + * we're parsing a complete "(...)" as a complete + * zsh pattern. In that case, we treat this as a + * single instance of a case pattern but we pretend + * we're doing proper case parsing --- in which the + * parentheses and bar are in different words from + * the string, so may be separated by whitespace. + * So we quietly massage the whitespace and hope + * no one noticed. This is horrible, but it's + * unfortunately too difficult to combine traditional + * zsh patterns with a properly parsed case pattern + * without generating incompatibilities which aren't + * all that popular (I've discovered). + * - We can also end up with something other than ")" or "|" + * just because we're looking at garbage. + * + * Because of the second case, what happens next might + * be the start of the command after the pattern, so we + * need to treat it as in command position. Luckily + * this doesn't affect our ability to match a | or ) as + * these are valid on command lines. + */ incasepat = 0; incmdpos = 1; - type = WC_CASE_OR; for (;;) { zshlex(); if (tok == OUTPAR) { + ecstr(str); + ecadd(ecnpats++); + nalts++; + incasepat = 0; incmdpos = 1; zshlex(); break; } else if (tok == BAR) { - char *str2; - int sl = strlen(str); + ecstr(str); + ecadd(ecnpats++); + nalts++; incasepat = 1; incmdpos = 0; - str2 = hcalloc(sl + 2); - strcpy(str2, str); - str2[sl] = Bar; - str2[sl+1] = '\0'; - str = str2; } else { - int sl = strlen(str); - - if (!sl || str[sl - 1] != Bar) { - /* POSIX allows (foo*) patterns */ - int pct; + if (!nalts && str[0] == Inpar) { + int pct = 0, sl; char *s; - for (s = str, pct = 0; *s; s++) { + for (s = str; *s; s++) { if (*s == Inpar) pct++; if (!pct) @@ -1227,29 +1259,26 @@ par_case(int *cmplx) "BUG: strange case pattern"); str[sl - 1] = '\0'; chuck(str); + ecstr(str); + ecadd(ecnpats++); + nalts++; break; - } else { - char *str2; - - if (tok != STRING) - YYERRORV(oecused); - str2 = hcalloc(sl + strlen(tokstr) + 1); - strcpy(str2, str); - strcpy(str2 + sl, tokstr); - str = str2; } + YYERRORV(oecused); } + + zshlex(); + if (tok != STRING) + YYERRORV(oecused); + str = dupstring(tokstr); } - pp = ecadd(0); - ecstr(str); - ecadd(ecnpats++); par_save_list(cmplx); - n++; if (tok == SEMIAMP) type = WC_CASE_AND; else if (tok == SEMIBAR) type = WC_CASE_TESTAND; ecbuf[pp] = WCB_CASE(type, ecused - 1 - pp); + ecbuf[palts] = nalts; if ((tok == ESAC && !brflag) || (tok == OUTBRACE && brflag)) break; if (tok != DSEMI && tok != SEMIAMP && tok != SEMIBAR) @@ -1259,6 +1288,7 @@ par_case(int *cmplx) zshlex(); } incmdpos = 1; + incasepat = 0; zshlex(); ecbuf[p] = WCB_CASE(WC_CASE_HEAD, ecused - 1 - p); diff --git a/Src/pattern.c b/Src/pattern.c index 17cd40c23..4e5e8a110 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -1405,7 +1405,16 @@ patcomppiece(int *flagp, int paren) starter = patnode(P_ANYBUT); } else starter = patnode(P_ANYOF); - if (*patparse == Outbrack) { + /* + * []...] means match a "]" or other included characters. + * However, to be a bit helpful and for compatibility + * with other shells, don't take in that sense if + * there's no further "]". That's still imperfect, + * but it's all we can do --- we're required to + * treat [$var]*[$var]with empty var as [ ... ] + * containing "]*[". + */ + if (*patparse == Outbrack && strchr(patparse+1, Outbrack)) { patparse++; patadd(NULL, ']', 1, PA_NOALIGN); } @@ -3622,7 +3631,7 @@ patmatchrange(char *range, int ch, int *indptr, int *mtp) return 1; break; case PP_PRINT: - if (ISPRINT(ch)) + if (ZISPRINT(ch)) return 1; break; case PP_PUNCT: diff --git a/Src/subst.c b/Src/subst.c index f52bcdfc8..d4a04b8e5 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -259,10 +259,19 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub) #endif str--; } else if (c == Inparmath) { - /* Math substitution of the form $((...)) */ + /* + * Math substitution of the form $((...)). + * These can be nested, for goodness sake... + */ + int mathpar = 1; str[-1] = '\0'; - while (*str != Outparmath && *str) + while (mathpar && *str) { str++; + if (*str == Outparmath) + mathpar--; + else if (*str == Inparmath) + mathpar++; + } if (*str != Outparmath) { zerr("failed to find end of math substitution"); return NULL; @@ -1592,7 +1601,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) /* combination of (L), (U) and (C) flags. */ int casmod = CASMOD_NONE; /* - * quotemod says we are doing either (q) (positive), (Q) (negative) + * quotemod says we are doing either (q/b) (positive), (Q) (negative) * or not (0). quotetype counts the q's for the first case. * quoterr is simply (X) but gets passed around a lot because the * combination (eX) needs it. @@ -1845,7 +1854,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) break; case 'q': - if (quotetype == QT_DOLLARS) + if (quotetype == QT_DOLLARS || + quotetype == QT_BACKSLASH_PATTERN) goto flagerr; if (s[1] == '-') { if (quotemod) @@ -1861,6 +1871,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) quotemod++, quotetype++; } break; + case 'b': + if (quotemod || quotetype != QT_NONE) + goto flagerr; + quotemod = 1; + quotetype = QT_BACKSLASH_PATTERN; + break; case 'Q': quotemod--; break; @@ -3460,7 +3476,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) if (quotemod) { int pre = 0, post = 0; - if (quotemod > 0 && quotetype > QT_BACKSLASH) { + if (quotemod > 0) { switch (quotetype) { case QT_DOLLARS: @@ -3471,6 +3487,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) case QT_SINGLE_OPTIONAL: /* quotes will be added for us */ + case QT_BACKSLASH: + case QT_BACKSLASH_PATTERN: + /* no quotes */ break; default: diff --git a/Src/text.c b/Src/text.c index b58c2516d..958303c68 100644 --- a/Src/text.c +++ b/Src/text.c @@ -602,6 +602,7 @@ gettext2(Estate state) case WC_CASE: if (!s) { Wordcode end = state->pc + WC_CASE_SKIP(code); + wordcode nalts; taddstr("case "); taddstr(ecgetstr(state, EC_NODUP, NULL)); @@ -622,8 +623,13 @@ gettext2(Estate state) taddchr(' '); taddstr("("); code = *state->pc++; - taddstr(ecgetstr(state, EC_NODUP, NULL)); - state->pc++; + nalts = *state->pc++; + while (nalts--) { + taddstr(ecgetstr(state, EC_NODUP, NULL)); + state->pc++; + if (nalts) + taddstr(" | "); + } taddstr(") "); tindent++; n = tpush(code, 0); @@ -631,6 +637,7 @@ gettext2(Estate state) n->pop = (state->pc - 2 + WC_CASE_SKIP(code) >= end); } } else if (state->pc < s->u._case.end) { + wordcode nalts; dec_tindent(); switch (WC_CASE_TYPE(code)) { case WC_CASE_OR: @@ -638,11 +645,11 @@ gettext2(Estate state) break; case WC_CASE_AND: - taddstr(";&"); + taddstr(" ;&"); break; default: - taddstr(";|"); + taddstr(" ;|"); break; } if (tnewlins) @@ -651,8 +658,13 @@ gettext2(Estate state) taddchr(' '); taddstr("("); code = *state->pc++; - taddstr(ecgetstr(state, EC_NODUP, NULL)); - state->pc++; + nalts = *state->pc++; + while (nalts--) { + taddstr(ecgetstr(state, EC_NODUP, NULL)); + state->pc++; + if (nalts) + taddstr(" | "); + } taddstr(") "); tindent++; s->code = code; @@ -666,11 +678,11 @@ gettext2(Estate state) break; case WC_CASE_AND: - taddstr(";&"); + taddstr(" ;&"); break; default: - taddstr(";|"); + taddstr(" ;|"); break; } dec_tindent(); diff --git a/Src/utils.c b/Src/utils.c index 3d12807e2..271c800fd 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -414,7 +414,7 @@ nicechar(int c) static char buf[6]; char *s = buf; c &= 0xff; - if (ISPRINT(c)) + if (ZISPRINT(c)) goto done; if (c & 0x80) { if (isset(PRINTEIGHTBIT)) @@ -423,7 +423,7 @@ nicechar(int c) *s++ = 'M'; *s++ = '-'; c &= 0x7f; - if(ISPRINT(c)) + if(ZISPRINT(c)) goto done; } if (c == 0x7f) { @@ -3694,6 +3694,8 @@ inittyptab(void) typtab[bangchar] |= ISPECIAL; } else typtab_flags &= ~ZTF_BANGCHAR; + for (s = PATCHARS; *s; s++) + typtab[STOUC(*s)] |= IPATTERN; unqueue_signals(); } @@ -5075,6 +5077,10 @@ quotestring(const char *s, char **e, int instring) alloclen = slen * 7 + 1; break; + case QT_BACKSLASH_PATTERN: + alloclen = slen * 2 + 1; + break; + case QT_SINGLE_OPTIONAL: /* * Here, we may need to add single quotes. @@ -5094,7 +5100,7 @@ quotestring(const char *s, char **e, int instring) quotestart = v = buf = zshcalloc(alloclen); DPUTS(instring < QT_BACKSLASH || instring == QT_BACKTICK || - instring > QT_SINGLE_OPTIONAL, + instring > QT_BACKSLASH_PATTERN, "BUG: bad quote type in quotestring"); u = s; if (instring == QT_DOLLARS) { @@ -5134,9 +5140,18 @@ quotestring(const char *s, char **e, int instring) u = uend; } } - } - else - { + } else if (instring == QT_BACKSLASH_PATTERN) { + while (*u) { + if (e && !sf && *e == u) { + *e = v; + sf = 1; + } + + if (ipattern(*u)) + *v++ = '\\'; + *v++ = *u++; + } + } else { if (shownull) { /* We can't show an empty string with just backslash quoting. */ if (!*u) { @@ -215,6 +215,10 @@ struct mathfunc { #define SPECCHARS "#$^*()=|{}[]`<>?~;&\n\t \\\'\"" +/* chars that need to be quoted for pattern matching */ + +#define PATCHARS "#^*()|[]<>?~\\" + /* * Types of quote. This is used in various places, so care needs * to be taken when changing them. (Oooh, don't you look surprised.) @@ -249,6 +253,12 @@ enum { */ QT_SINGLE_OPTIONAL, /* + * Only quote pattern characters. + * ${(b)foo} guarantees that ${~foo} matches the string + * contained in foo. + */ + QT_BACKSLASH_PATTERN, + /* * As QT_BACKSLASH, but a NULL string is shown as ''. */ QT_BACKSLASH_SHOWNULL @@ -2978,9 +2988,9 @@ typedef wint_t convchar_t; * We can't be quite sure the wcwidth we've provided is entirely * in agreement with the system's, so be extra safe. */ -#define IS_COMBINING(wc) (WCWIDTH(wc) == 0 && !iswcntrl(wc)) +#define IS_COMBINING(wc) (wc != 0 && WCWIDTH(wc) == 0 && !iswcntrl(wc)) #else -#define IS_COMBINING(wc) (WCWIDTH(wc) == 0) +#define IS_COMBINING(wc) (wc != 0 && WCWIDTH(wc) == 0) #endif /* * Test for the base of a combining character. diff --git a/Src/ztype.h b/Src/ztype.h index d1bef0a5a..76589b152 100644 --- a/Src/ztype.h +++ b/Src/ztype.h @@ -42,6 +42,7 @@ #define IMETA (1 << 12) #define IWSEP (1 << 13) #define INULL (1 << 14) +#define IPATTERN (1 << 15) #define zistype(X,Y) (typtab[STOUC(X)] & Y) #define idigit(X) zistype(X,IDIGIT) #define ialnum(X) zistype(X,IALNUM) @@ -58,6 +59,7 @@ #define imeta(X) zistype(X,IMETA) #define iwsep(X) zistype(X,IWSEP) #define inull(X) zistype(X,INULL) +#define ipattern(X) zistype(X,IPATTERN) /* * Bit flags for typtab_flags --- preserved after @@ -77,7 +79,7 @@ #endif #if defined(__APPLE__) && defined(BROKEN_ISPRINT) -#define ISPRINT(c) isprint_ascii(c) +#define ZISPRINT(c) isprint_ascii(c) #else -#define ISPRINT(c) isprint(c) +#define ZISPRINT(c) isprint(c) #endif diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst index f04dddaa8..50058e25d 100644 --- a/Test/A01grammar.ztst +++ b/Test/A01grammar.ztst @@ -543,6 +543,7 @@ . ./bad_syntax 126: Attempt to "." file with bad syntax. ?./bad_syntax:2: parse error near `\n' +# ` echo 'false' >dot_false . ./dot_false @@ -572,6 +573,7 @@ $ZTST_testdir/../Src/zsh -f myscript 127q:PATHSCRIPT option not used. ?$ZTST_testdir/../Src/zsh: can't open input file: myscript +# ' $ZTST_testdir/../Src/zsh -fc 'echo $0; echo $1' myargzero myargone 0:$0 is traditionally if bizarrely set to the first argument with -c @@ -589,3 +591,107 @@ >success2 >read it >read it + + ( + mywrap() { echo BEGIN; true; echo END } + mytest() { { exit 3 } always { mywrap }; print Exited before this } + mytest + print Exited before this, too + ) +3:Exit and always block with functions: simple +>BEGIN +>END + + ( + mytrue() { echo mytrue; return 0 } + mywrap() { echo BEGIN; mytrue; echo END } + mytest() { { exit 4 } always { mywrap }; print Exited before this } + mytest + print Exited before this, too + ) +4:Exit and always block with functions: nested +>BEGIN +>mytrue +>END + + (emulate sh -c ' + fn() { + case $1 in + ( one | two | three ) + print Matched $1 + ;; + ( fo* | fi* | si* ) + print Pattern matched $1 + ;; + ( []x | a[b]* ) + print Character class matched $1 + ;; + esac + } + ' + which fn + fn one + fn two + fn three + fn four + fn five + fn six + fn abecedinarian + fn xylophone) +0: case word handling in sh emulation (SH_GLOB parentheses) +>fn () { +> case $1 in +> (one | two | three) print Matched $1 ;; +> (fo* | fi* | si*) print Pattern matched $1 ;; +> ([]x | a[b]*) print Character class matched $1 ;; +> esac +>} +>Matched one +>Matched two +>Matched three +>Pattern matched four +>Pattern matched five +>Pattern matched six +>Character class matched abecedinarian + + case grumph in + ( no | (grumph) ) + print 1 OK + ;; + esac + case snruf in + ( fleer | (|snr(|[au]f)) ) + print 2 OK + ;; + esac +0: case patterns within words +>1 OK +>2 OK + + case horrible in + ([a-m])(|[n-z])rr(|ib(um|le|ah))) + print It worked + ;; + esac + case "a string with separate words" in + (*with separate*)) + print That worked, too + ;; + esac +0:Unbalanced parentheses and spaces with zsh pattern +>It worked +>That worked, too + + case horrible in + (([a-m])(|[n-z])rr(|ib(um|le|ah))) + print It worked + ;; + esac + case "a string with separate words" in + (*with separate*) + print That worked, too + ;; + esac +0:Balanced parentheses and spaces with zsh pattern +>It worked +>That worked, too diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst index 08163eb52..b294e65ca 100644 --- a/Test/A02alias.ztst +++ b/Test/A02alias.ztst @@ -59,7 +59,8 @@ >And aliases are expanded $ZTST_testdir/../Src/zsh -fis <<<' - PROMPT="" + unsetopt PROMPT_SP + PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2="" exec 2>&1 alias \{=echo { begin @@ -68,16 +69,27 @@ 0:Aliasing reserved tokens >begin >end -*>*4*{ begin -*>*5*{end +*>*5*{ begin +*>*6*{end $ZTST_testdir/../Src/zsh -fis <<<' - PROMPT="" + unsetopt PROMPT_SP + PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2="" exec 2>&1 alias -g S=\" echo S a string S " fc -l -1' 2>/dev/null 0:Global aliasing quotes > a string S -*>*4*echo S a string S " +*>*5*echo S a string S " # Note there is a trailing space on the "> a string S " line + + ( + unalias -a + alias + ) +0:unalias -a + + alias -s foo=print + unalias -as +0:unalias -as diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index f4fb8ecb9..57a7caa12 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -475,13 +475,36 @@ print ${+pbro} >&2 (typeset pbro=3) (pbro=4) + readonly -p | grep pbro >&2 # shows up as "readonly" although unset typeset -r pbro # idempotent (no error)... print ${+pbro} >&2 # ...so still readonly... typeset +r pbro # ...can't turn it off ) -1:Readonly with POSIX_BUILTINS +1:readonly with POSIX_BUILTINS ?0 ?(eval):5: read-only variable: pbro ?(eval):6: read-only variable: pbro +?typeset -r pbro ?0 -?(eval):9: read-only variable: pbro +?(eval):10: read-only variable: pbro + + readonly foo=bar novalue + readonly -p +0:readonly -p output (no readonly specials) +>typeset -r foo=bar +>typeset -r novalue='' + + local -a a1 a2 + local -r r1=yes r2=no + a1=(one two) a2=(three four) + readonly a1 + typeset -pm 'a[12]' + typeset -pm 'r[12]' +0:readonly -p output +>typeset -a a1 +>a1=(one two) +>typeset -ar a1 +>typeset -a a2 +>a2=(three four) +>typeset -r r1=yes +>typeset -r r2=no diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst index e2dfe56fc..d284e0869 100644 --- a/Test/C01arith.ztst +++ b/Test/C01arith.ztst @@ -387,3 +387,11 @@ print $((`:`)) 0:Null string in arithmetic evaluation after command substitution >0 + + print $(( 1 + $(( 2 + 3 )) )) + print $(($((3+4)))) + print $((1*$((2*$((3))*4))*5)) +0:Nested math substitutions. Yes, I know, very useful. +>6 +>7 +>120 diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 42c7b4ec6..d96ffb64f 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1699,3 +1699,7 @@ > > >Four + + funnychars='The qu*nk br!wan f@x j/mps o[]r \(e la~# ^"&;' + [[ $funnychars = ${~${(b)funnychars}} ]] +0:${(b)...} quoting protects from GLOB_SUBST diff --git a/configure.ac b/configure.ac index e4de193ed..6a99aec1d 100644 --- a/configure.ac +++ b/configure.ac @@ -634,7 +634,12 @@ AC_SUBST(YODL_OPTIONS) AC_CHECK_PROGS([PDFETEX], [pdfetex], [: pdfetex]) AC_CHECK_PROGS([TEXI2PDF], [texi2pdf], []) -AC_CHECK_PROGS([TEXI2HTML], [texi2html], []) +AC_CHECK_PROGS([TEXI2HTML], [texi2any texi2html], [: texi2html]) + +if test x"$TEXI2HTML" = xtexi2any; then + TEXI2HTML='texi2any -c TEXI2HTML=1' +fi + AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr]) if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then |