zsh.info-5 (zsh-5.8.1-doc.tar.xz) | : | zsh.info-5 (zsh-5.9-doc.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 428 | skipping to change at line 428 | |||
The zsh/zutil Module::. This is the same mechanism used in the | The zsh/zutil Module::. This is the same mechanism used in the | |||
completion system. | completion system. | |||
The styles below are all examined in the context :datetime:FUNCTION:, | The styles below are all examined in the context :datetime:FUNCTION:, | |||
for example :datetime:calendar:. | for example :datetime:calendar:. | |||
calendar-file | calendar-file | |||
The location of the main calendar. The default is ~/calendar. | The location of the main calendar. The default is ~/calendar. | |||
date-format | date-format | |||
A strftime format string (see man page strftime(3)) with the zsh | A strftime format string (see strftime(3)) with the zsh extensions | |||
extensions providing various numbers with no leading zero or space | providing various numbers with no leading zero or space if the | |||
if the number is a single digit as described for the %D{STRING} | number is a single digit as described for the %D{STRING} prompt | |||
prompt format in *Note Prompt Expansion::. | format in *Note Prompt Expansion::. | |||
This is used for outputting dates in calendar, both to support the | This is used for outputting dates in calendar, both to support the | |||
-v option and when adding recurring events back to the calendar | -v option and when adding recurring events back to the calendar | |||
file, and in calendar_showdate as the final output format. | file, and in calendar_showdate as the final output format. | |||
If the style is not set, the default used is similar the standard | If the style is not set, the default used is similar the standard | |||
system format as output by the date command (also known as `ctime | system format as output by the date command (also known as `ctime | |||
format'): `%a %b %d %H:%M:%S %Z %Y'. | format'): `%a %b %d %H:%M:%S %Z %Y'. | |||
done-file | done-file | |||
skipping to change at line 1397 | skipping to change at line 1397 | |||
25 Zftp Function System | 25 Zftp Function System | |||
*********************** | *********************** | |||
25.1 Description | 25.1 Description | |||
================ | ================ | |||
This describes the set of shell functions supplied with the source | This describes the set of shell functions supplied with the source | |||
distribution as an interface to the zftp builtin command, allowing you | distribution as an interface to the zftp builtin command, allowing you | |||
to perform FTP operations from the shell command line or within | to perform FTP operations from the shell command line or within | |||
functions or scripts. The interface is similar to a traditional FTP | functions or scripts. The interface is similar to a traditional FTP | |||
client (e.g. the ftp command itself, see man page ftp(1)), but as it is | client (e.g. the ftp command itself, see ftp(1)), but as it is entirely | |||
entirely done within the shell all the familiar completion, editing and | done within the shell all the familiar completion, editing and globbing | |||
globbing features, and so on, are present, and macros are particularly | features, and so on, are present, and macros are particularly simple to | |||
simple to write as they are just ordinary shell functions. | write as they are just ordinary shell functions. | |||
The prerequisite is that the zftp command, as described in *Note The | The prerequisite is that the zftp command, as described in *Note The | |||
zsh/zftp Module:: , must be available in the version of zsh installed | zsh/zftp Module:: , must be available in the version of zsh installed | |||
at your site. If the shell is configured to load new commands at run | at your site. If the shell is configured to load new commands at run | |||
time, it probably is: typing `zmodload zsh/zftp' will make sure (if | time, it probably is: typing `zmodload zsh/zftp' will make sure (if | |||
that runs silently, it has worked). If this is not the case, it is | that runs silently, it has worked). If this is not the case, it is | |||
possible zftp was linked into the shell anyway: to test this, type | possible zftp was linked into the shell anyway: to test this, type | |||
`which zftp' and if zftp is available you will get the message `zftp: | `which zftp' and if zftp is available you will get the message `zftp: | |||
shell built-in command'. | shell built-in command'. | |||
skipping to change at line 1881 | skipping to change at line 1881 | |||
25.4.1 Configuration | 25.4.1 Configuration | |||
-------------------- | -------------------- | |||
Various styles are available using the standard shell style mechanism, | Various styles are available using the standard shell style mechanism, | |||
described in *Note The zsh/zutil Module::. Briefly, the command `zstyle | described in *Note The zsh/zutil Module::. Briefly, the command `zstyle | |||
':zftp:*' STYLE VALUE ...'. defines the STYLE to have value VALUE; | ':zftp:*' STYLE VALUE ...'. defines the STYLE to have value VALUE; | |||
more than one value may be given, although that is not useful in the | more than one value may be given, although that is not useful in the | |||
cases described here. These values will then be used throughout the | cases described here. These values will then be used throughout the | |||
zftp function system. For more precise control, the first argument, | zftp function system. For more precise control, the first argument, | |||
which gives a context in which the style applies, can be modified to | which gives a pattern that matches _contexts_ in which the style | |||
include a particular function, as for example `:zftp:zfget': the style | applies, can be modified to include a particular function, as for | |||
will then have the given value only in the zfget function. Values for | example `:zftp:zfget': the style will then have the given value only in | |||
the same style in different contexts may be set; the most specific | the zfget function, and will override styles set under `:zftp:*'. Note | |||
function will be used, where strings are held to be more specific than | that only the top level function name, as called by the user, is used; | |||
patterns, and longer patterns and shorter patterns. Note that only the | calling of lower level functions is transparent to the user. Hence | |||
top level function name, as called by the user, is used; calling of | modifications to the title bar in zftp_chpwd use the contexts | |||
lower level functions is transparent to the user. Hence modifications | :zftp:zfopen, :zftp:zfcd, etc., depending where it was called from. | |||
to the title bar in zftp_chpwd use the contexts :zftp:zfopen, | The following styles are understood: | |||
:zftp:zfcd, etc., depending where it was called from. The following | ||||
styles are understood: | ||||
progress | progress | |||
Controls the way that zftp_progress reports on the progress of a | Controls the way that zftp_progress reports on the progress of a | |||
transfer. If empty, unset, or `none', no progress report is made; | transfer. If empty, unset, or `none', no progress report is made; | |||
if `bar' a growing bar of inverse video is shown; if `percent' (or | if `bar' a growing bar of inverse video is shown; if `percent' (or | |||
any other string, though this may change in future), the | any other string, though this may change in future), the | |||
percentage of the file transferred is shown. The bar meter | percentage of the file transferred is shown. The bar meter | |||
requires that the width of the terminal be available via the | requires that the width of the terminal be available via the | |||
$COLUMNS parameter (normally this is set automatically). If the | $COLUMNS parameter (normally this is set automatically). If the | |||
size of the file being transferred is not available, bar and | size of the file being transferred is not available, bar and | |||
skipping to change at line 2082 | skipping to change at line 2080 | |||
Help files are installed by default to a subdirectory of /usr/share/zsh | Help files are installed by default to a subdirectory of /usr/share/zsh | |||
or /usr/local/share/zsh. | or /usr/local/share/zsh. | |||
To create your own help files with helpfiles, choose or create a | To create your own help files with helpfiles, choose or create a | |||
directory where the individual command help files will reside. For | directory where the individual command help files will reside. For | |||
example, you might choose ~/zsh_help. If you unpacked the zsh | example, you might choose ~/zsh_help. If you unpacked the zsh | |||
distribution in your home directory, you would use the commands: | distribution in your home directory, you would use the commands: | |||
mkdir ~/zsh_help | mkdir ~/zsh_help | |||
perl ~/zsh-5.8.1/Util/helpfiles ~/zsh_help | perl ~/zsh-5.9/Util/helpfiles ~/zsh_help | |||
The HELPDIR parameter tells run-help where to look for the help files. | The HELPDIR parameter tells run-help where to look for the help files. | |||
When unset, it uses the default installation path. To use your own set | When unset, it uses the default installation path. To use your own set | |||
of help files, set this to the appropriate path in one of your startup | of help files, set this to the appropriate path in one of your startup | |||
files: | files: | |||
HELPDIR=~/zsh_help | HELPDIR=~/zsh_help | |||
To use the run-help function, you need to add lines something like the | To use the run-help function, you need to add lines something like the | |||
following to your .zshrc or equivalent startup file: | following to your .zshrc or equivalent startup file: | |||
skipping to change at line 2198 | skipping to change at line 2196 | |||
-------------------------- | -------------------------- | |||
The large number of possible combinations of keyboards, workstations, | The large number of possible combinations of keyboards, workstations, | |||
terminals, emulators, and window systems makes it impossible for zsh to | terminals, emulators, and window systems makes it impossible for zsh to | |||
have built-in key bindings for every situation. The zkbd utility, | have built-in key bindings for every situation. The zkbd utility, | |||
found in Functions/Misc, can help you quickly create key bindings for | found in Functions/Misc, can help you quickly create key bindings for | |||
your configuration. | your configuration. | |||
Run zkbd either as an autoloaded function, or as a shell script: | Run zkbd either as an autoloaded function, or as a shell script: | |||
zsh -f ~/zsh-5.8.1/Functions/Misc/zkbd | zsh -f ~/zsh-5.9/Functions/Misc/zkbd | |||
When you run zkbd, it first asks you to enter your terminal type; if | When you run zkbd, it first asks you to enter your terminal type; if | |||
the default it offers is correct, just press return. It then asks you | the default it offers is correct, just press return. It then asks you | |||
to press a number of different keys to determine characteristics of your | to press a number of different keys to determine characteristics of your | |||
keyboard and terminal; zkbd warns you if it finds anything out of the | keyboard and terminal; zkbd warns you if it finds anything out of the | |||
ordinary, such as a Delete key that sends neither ^H nor ^?. | ordinary, such as a Delete key that sends neither ^H nor ^?. | |||
The keystrokes read by zkbd are recorded as a definition for an | The keystrokes read by zkbd are recorded as a definition for an | |||
associative array named key, written to a file in the subdirectory | associative array named key, written to a file in the subdirectory | |||
.zkbd within either your HOME or ZDOTDIR directory. The name of the | .zkbd within either your HOME or ZDOTDIR directory. The name of the | |||
skipping to change at line 2246 | skipping to change at line 2244 | |||
The script named reporter, found in the Util directory of the | The script named reporter, found in the Util directory of the | |||
distribution, is provided for this purpose. (It is also possible to | distribution, is provided for this purpose. (It is also possible to | |||
autoload reporter, but reporter is not installed in fpath by default.) | autoload reporter, but reporter is not installed in fpath by default.) | |||
This script outputs a detailed dump of the shell state, in the form of | This script outputs a detailed dump of the shell state, in the form of | |||
another script that can be read with `zsh -f' to recreate that state. | another script that can be read with `zsh -f' to recreate that state. | |||
To use reporter, read the script into your shell with the `.' command | To use reporter, read the script into your shell with the `.' command | |||
and redirect the output into a file: | and redirect the output into a file: | |||
. ~/zsh-5.8.1/Util/reporter > zsh.report | . ~/zsh-5.9/Util/reporter > zsh.report | |||
You should check the zsh.report file for any sensitive information such | You should check the zsh.report file for any sensitive information such | |||
as passwords and delete them by hand before sending the script to the | as passwords and delete them by hand before sending the script to the | |||
developers. Also, as the output can be voluminous, it's best to wait | developers. Also, as the output can be voluminous, it's best to wait | |||
for the developers to ask for this information before sending it. | for the developers to ask for this information before sending it. | |||
You can also use reporter to dump only a subset of the shell state. | You can also use reporter to dump only a subset of the shell state. | |||
This is sometimes useful for creating startup files for the first time. | This is sometimes useful for creating startup files for the first time. | |||
Most of the output from reporter is far more detailed than usually is | Most of the output from reporter is far more detailed than usually is | |||
necessary for a startup file, but the aliases, options, and zstyles | necessary for a startup file, but the aliases, options, and zstyles | |||
skipping to change at line 2365 | skipping to change at line 2363 | |||
HOOK is one of isearch-exit, isearch-update, line-pre-redraw, | HOOK is one of isearch-exit, isearch-update, line-pre-redraw, | |||
line-init, line-finish, history-line-set, or keymap-select, | line-init, line-finish, history-line-set, or keymap-select, | |||
corresponding to each of the special widgets zle-isearch-exit, | corresponding to each of the special widgets zle-isearch-exit, | |||
etc. The special widget names are also accepted as the HOOK | etc. The special widget names are also accepted as the HOOK | |||
argument. | argument. | |||
WIDGETNAME is the name of a ZLE widget. If no options are given | WIDGETNAME is the name of a ZLE widget. If no options are given | |||
this is added to the array of widgets to be invoked in the given | this is added to the array of widgets to be invoked in the given | |||
hook context. Widgets are invoked in the order they were added, | hook context. Widgets are invoked in the order they were added, | |||
with | with | |||
zle WIDGETNAME -Nw -- "$@" | zle WIDGETNAME -Nw -f "nolast" -- "$@" | |||
Note that this means that the `WIDGET' special parameter tracks the | Note that this means that the `WIDGET' special parameter tracks the | |||
WIDGETNAME when the widget function is called, rather than tracking | WIDGETNAME when the widget function is called, rather than tracking | |||
the name of the corresponding special hook widget. | the name of the corresponding special hook widget. | |||
If the option -d is given, the WIDGETNAME is removed from the | If the option -d is given, the WIDGETNAME is removed from the | |||
array of widgets to be executed. | array of widgets to be executed. | |||
If the option -D is given, the WIDGETNAME is treated as a pattern | If the option -D is given, the WIDGETNAME is treated as a pattern | |||
and any matching names of widgets are removed from the array. | and any matching names of widgets are removed from the array. | |||
skipping to change at line 2481 | skipping to change at line 2479 | |||
-r | -r | |||
sets the variable reply to the current set of directories. Nothing | sets the variable reply to the current set of directories. Nothing | |||
is printed and the directory is not changed. | is printed and the directory is not changed. | |||
-e | -e | |||
allows you to edit the list of directories, one per line. The | allows you to edit the list of directories, one per line. The | |||
list can be edited to any extent you like; no sanity checking is | list can be edited to any extent you like; no sanity checking is | |||
performed. Completion is available. No quoting is necessary | performed. Completion is available. No quoting is necessary | |||
(except for newlines, where I have in any case no sympathy); | (except for newlines, where I have in any case no sympathy); | |||
directories are in unabbreviated from and contain an absolute | directories are in unabbreviated form and contain an absolute | |||
path, i.e. they start with /. Usually the first entry should be | path, i.e. they start with /. Usually the first entry should be | |||
left as the current directory. | left as the current directory. | |||
-p 'PATTERN' | -p 'PATTERN' | |||
Prunes any items in the directory list that match the given | Prunes any items in the directory list that match the given | |||
extended glob pattern; the pattern needs to be quoted from | extended glob pattern; the pattern needs to be quoted from | |||
immediate expansion on the command line. The pattern is matched | immediate expansion on the command line. The pattern is matched | |||
against each completely expanded file name in the list; the full | against each completely expanded file name in the list; the full | |||
string must match, so wildcards at the end (e.g. '*removeme*') are | string must match, so wildcards at the end (e.g. '*removeme*') are | |||
needed to remove entries with a given substring. | needed to remove entries with a given substring. | |||
skipping to change at line 2719 | skipping to change at line 2717 | |||
------------ | ------------ | |||
To use the function, first define a wrapper function for your specific | To use the function, first define a wrapper function for your specific | |||
case. We'll assume it's to be autoloaded. This can have any name but | case. We'll assume it's to be autoloaded. This can have any name but | |||
we'll refer to it as zdn_mywrapper. This wrapper function will define | we'll refer to it as zdn_mywrapper. This wrapper function will define | |||
various variables and then call this function with the same arguments | various variables and then call this function with the same arguments | |||
that the wrapper function gets. This configuration is described below. | that the wrapper function gets. This configuration is described below. | |||
Then arrange for the wrapper to be run as a zsh_directory_name hook: | Then arrange for the wrapper to be run as a zsh_directory_name hook: | |||
autoload -Uz add-zsh-hook zsh_diretory_name_generic zdn_mywrapper | autoload -Uz add-zsh-hook zsh_directory_name_generic zdn_mywrapper | |||
add-zsh-hook -U zsh_directory_name zdn_mywrapper | add-zsh-hook -U zsh_directory_name zdn_mywrapper | |||
26.4.2 Configuration | 26.4.2 Configuration | |||
-------------------- | -------------------- | |||
The wrapper function should define a local associative array zdn_top. | The wrapper function should define a local associative array zdn_top. | |||
Alternatively, this can be set with a style called mapping. The | Alternatively, this can be set with a style called mapping. The | |||
context for the style is :zdn:WRAPPER-NAME where WRAPPER-NAME is the | context for the style is :zdn:WRAPPER-NAME where WRAPPER-NAME is the | |||
function calling zsh_directory_name_generic; for example: | function calling zsh_directory_name_generic; for example: | |||
skipping to change at line 3174 | skipping to change at line 3172 | |||
/usr/bin but your sysadmin installed a newer version in | /usr/bin but your sysadmin installed a newer version in | |||
/usr/local/bin. Instead of changing the order of your $PATH | /usr/local/bin. Instead of changing the order of your $PATH | |||
parameter, you can do this: | parameter, you can do this: | |||
zstyle ':vcs_info:git:*:-all-' command /usr/local/bin/git | zstyle ':vcs_info:git:*:-all-' command /usr/local/bin/git | |||
use-server | use-server | |||
This is used by the Perforce backend (p4) to decide if it should | This is used by the Perforce backend (p4) to decide if it should | |||
contact the Perforce server to find out if a directory is managed | contact the Perforce server to find out if a directory is managed | |||
by Perforce. This is the only reliable way of doing this, but runs | by Perforce. This is the only reliable way of doing this, but runs | |||
the risk of a delay if the server name cannot be found. If the | the risk of a delay if the server name cannot be found. If the | |||
server (more specifically, the host:port pair describing the | server (more specifically, the HOST:PORT pair describing the | |||
server) cannot be contacted, its name is put into the associative | server) cannot be contacted, its name is put into the associative | |||
array vcs_info_p4_dead_servers and is not contacted again during | array vcs_info_p4_dead_servers and is not contacted again during | |||
the session until it is removed by hand. If you do not set this | the session until it is removed by hand. If you do not set this | |||
style, the p4 backend is only usable if you have set the | style, the p4 backend is only usable if you have set the | |||
environment variable P4CONFIG to a file name and have | environment variable P4CONFIG to a file name and have | |||
corresponding files in the root directories of each Perforce | corresponding files in the root directories of each Perforce | |||
client. See comments in the function VCS_INFO_detect_p4 for more | client. See comments in the function VCS_INFO_detect_p4 for more | |||
detail. | detail. | |||
The Bazaar backend (bzr) uses this to permit contacting the server | The Bazaar backend (bzr) uses this to permit contacting the server | |||
about lightweight checkouts, see the check-for-changes style. | about lightweight checkouts, see the check-for-changes style. | |||
use-simple | use-simple | |||
If there are two different ways of gathering information, you can | If there are two different ways of gathering information, you can | |||
select the simpler one by setting this style to true; the default | select the simpler one by setting this style to true; the default | |||
is to use the not-that-simple code, which is potentially a lot | is to use the not-that-simple code, which is potentially a lot | |||
slower but might be more accurate in all possible cases. This | slower but might be more accurate in all possible cases. This | |||
style is used by the bzr and hg backends. In the case of hg it | style is used by the bzr, hg, and git backends. In the case of hg | |||
will invoke the external hexdump program to parse the binary | it will invoke the external hexdump program to parse the binary | |||
dirstate cache file; this method will not return the local | dirstate cache file; this method will not return the local | |||
revision number. | revision number. | |||
get-revision | get-revision | |||
If set to true, vcs_info goes the extra mile to figure out the | If set to true, vcs_info goes the extra mile to figure out the | |||
revision of a repository's work tree (currently for the git and hg | revision of a repository's work tree (currently for the git and hg | |||
backends, where this kind of information is not always vital). For | backends, where this kind of information is not always vital). For | |||
git, the hash value of the currently checked out commit is | git, the hash value of the currently checked out commit is | |||
available via the %i expansion. With hg, the local revision number | available via the %i expansion. With hg, the local revision number | |||
and the corresponding global hash are available via %i. | and the corresponding global hash are available via %i. | |||
skipping to change at line 3245 | skipping to change at line 3243 | |||
The value is subject to certain %-expansions described below. The | The value is subject to certain %-expansions described below. The | |||
expanded value is made available in the global backend_misc array | expanded value is made available in the global backend_misc array | |||
as ${backend_misc[patches]} (also if a set-patch-format hook is | as ${backend_misc[patches]} (also if a set-patch-format hook is | |||
used). | used). | |||
get-unapplied | get-unapplied | |||
This boolean style controls whether a backend should attempt to | This boolean style controls whether a backend should attempt to | |||
gather a list of unapplied patches (for example with Mercurial | gather a list of unapplied patches (for example with Mercurial | |||
Queue patches). | Queue patches). | |||
Used by the quilt and hg backends. | Used by the quilt, hg, and git backends. | |||
The default values for these styles in all contexts are: | The default values for these styles in all contexts are: | |||
formats | formats | |||
" (%s)-[%b]%u%c-" | " (%s)-[%b]%u%c-" | |||
actionformats | actionformats | |||
" (%s)-[%b|%a]%u%c-" | " (%s)-[%b|%a]%u%c-" | |||
branchformat | branchformat | |||
skipping to change at line 3393 | skipping to change at line 3391 | |||
addition to mq information). See the get-mq and get-bookmarks | addition to mq information). See the get-mq and get-bookmarks | |||
styles. Both of these styles may be enabled at the same time. If | styles. Both of these styles may be enabled at the same time. If | |||
both are enabled, both resulting strings will be shown separated | both are enabled, both resulting strings will be shown separated | |||
by a semicolon (that cannot currently be customized). | by a semicolon (that cannot currently be customized). | |||
The quilt `standalone' backend sets this expando to the same value | The quilt `standalone' backend sets this expando to the same value | |||
as the %Q expando. | as the %Q expando. | |||
%Q | %Q | |||
Quilt series information. When quilt is used (either in `addon' | Quilt series information. When quilt is used (either in `addon' | |||
mode or as a `standalone' backend), this expando is set to quilt | mode or as a `standalone' backend), this expando is set to the | |||
series' patch-format string. The set-patch-format hook and | quilt series' patch-format string. The set-patch-format hook and | |||
nopatch-format style are honoured. | nopatch-format style are honoured. | |||
See *Note vcs_info Quilt Support:: below for details. | See *Note vcs_info Quilt Support:: below for details. | |||
In branchformat these replacements are done: | In branchformat these replacements are done: | |||
%b | %b | |||
The branch name. | The branch name. For hg, the branch name can include a topic name. | |||
%r | %r | |||
The current revision number or the hgrevformat style for hg. | The current revision number or the hgrevformat style for hg. | |||
In hgrevformat these replacements are done: | In hgrevformat these replacements are done: | |||
%r | %r | |||
The current local revision number. | The current local revision number. | |||
%h | %h | |||
skipping to change at line 3497 | skipping to change at line 3495 | |||
in the VCS-STRING part of the context, where QUILT-MODE is either addon | in the VCS-STRING part of the context, where QUILT-MODE is either addon | |||
or standalone. Example: | or standalone. Example: | |||
:vcs_info:git.quilt-addon:default:REPO-ROOT-NAME. | :vcs_info:git.quilt-addon:default:REPO-ROOT-NAME. | |||
For `addon' mode to become active vcs_info must have already detected a | For `addon' mode to become active vcs_info must have already detected a | |||
real version control system controlling the directory. If that is the | real version control system controlling the directory. If that is the | |||
case, a directory that holds quilt's patches needs to be found. That | case, a directory that holds quilt's patches needs to be found. That | |||
directory is configurable via the `QUILT_PATCHES' environment variable. | directory is configurable via the `QUILT_PATCHES' environment variable. | |||
If that variable exists its value is used, otherwise the value | If that variable exists its value is used, otherwise the value | |||
`patches' is assumed. The value from $QUILT_PATCHES can be overwritten | `patches' is assumed. The value from $QUILT_PATCHES can be overwritten | |||
using the `quilt-patches' style. (Note: you can use vcs_info to keep | using the `quilt-patch-dir' style. (Note: you can use vcs_info to keep | |||
the value of $QUILT_PATCHES correct all the time via the post-quilt | the value of $QUILT_PATCHES correct all the time via the post-quilt | |||
hook). | hook). | |||
When the directory in question is found, quilt is assumed to be active. | When the directory in question is found, quilt is assumed to be active. | |||
To gather more information, vcs_info looks for a directory called `.pc'; | To gather more information, vcs_info looks for a directory called `.pc'; | |||
Quilt uses that directory to track its current state. If this directory | Quilt uses that directory to track its current state. If this directory | |||
does not exist we know that quilt has not done anything to the working | does not exist we know that quilt has not done anything to the working | |||
directory (read: no patches have been applied yet). | directory (read: no patches have been applied yet). | |||
If patches are applied, vcs_info will try to find out which. If you want | If patches are applied, vcs_info will try to find out which. If you want | |||
skipping to change at line 3600 | skipping to change at line 3598 | |||
Remove hook-functions from a given hook. The hook needs to be | Remove hook-functions from a given hook. The hook needs to be | |||
given as the first non-option argument; what follows is a list of | given as the first non-option argument; what follows is a list of | |||
hook-function names to un-register from the hook. If `-a' is used | hook-function names to un-register from the hook. If `-a' is used | |||
as the first argument, all occurrences of the functions are | as the first argument, all occurrences of the functions are | |||
unregistered. Otherwise only the last occurrence is removed (if a | unregistered. Otherwise only the last occurrence is removed (if a | |||
function was registered to a hook more than once). The `+vi-' | function was registered to a hook more than once). The `+vi-' | |||
prefix needs to be left out here. See *Note vcs_info Hooks:: | prefix needs to be left out here. See *Note vcs_info Hooks:: | |||
below for details. | below for details. | |||
vcs_info_lastmsg | vcs_info_lastmsg | |||
Outputs the last ${vcs_info_msg_*_} value. Takes into account the | Outputs the current values of ${vcs_info_msg_*_}. Takes into | |||
value of the use-prompt-escapes style in | account the value of the use-prompt-escapes style in | |||
':vcs_info:formats:command:-all-'. It also only prints max-exports | ':vcs_info:formats:command:-all-'. It also only prints max-exports | |||
values. | values. | |||
vcs_info_printsys [USER-CONTEXT] | vcs_info_printsys [USER-CONTEXT] | |||
Prints a list of all supported version control systems. Useful to | Prints a list of all supported version control systems. Useful to | |||
find out possible contexts (and which of them are enabled) or | find out possible contexts (and which of them are enabled) or | |||
values for the disable style. | values for the disable style. | |||
vcs_info_setsys | vcs_info_setsys | |||
Initializes vcs_info's internal list of available backends. With | Initializes vcs_info's internal list of available backends. With | |||
skipping to change at line 3738 | skipping to change at line 3736 | |||
${hook_com[hg-bookmark-string]} will be used in the %m escape in | ${hook_com[hg-bookmark-string]} will be used in the %m escape in | |||
formats and actionformats and will be available in the global | formats and actionformats and will be available in the global | |||
backend_misc array as ${backend_misc[bookmarks]}. | backend_misc array as ${backend_misc[bookmarks]}. | |||
gen-applied-string | gen-applied-string | |||
Called in the git (with stgit or during rebase or merge), and hg | Called in the git (with stgit or during rebase or merge), and hg | |||
(with mq) backends and in quilt support when the applied-string is | (with mq) backends and in quilt support when the applied-string is | |||
generated; the use-quilt zstyle must be true for quilt (the mq and | generated; the use-quilt zstyle must be true for quilt (the mq and | |||
stgit backends are active by default). | stgit backends are active by default). | |||
This hook gets the names of all applied patches which vcs_info | The arguments to this hook describe applied patches in the | |||
collected so far in the opposite order, which means that the first | opposite order, which means that the first argument is the | |||
argument is the top-most patch and so forth. | top-most patch and so forth. | |||
When the patches' log messages can be extracted, those are embedded | ||||
within each argument after a space, so each argument is of the form | ||||
`PATCH-NAME FIRST LINE OF THE LOG MESSAGE', where PATCH-NAME | ||||
contains no whitespace. The mq backend passes arguments of the | ||||
form `PATCH NAME', with possible embedded spaces, but without | ||||
extracting the patch's log message. | ||||
When setting ret to non-zero, the string in | When setting ret to non-zero, the string in | |||
${hook_com[applied-string]} will be available as %p in the | ${hook_com[applied-string]} will be available as %p in the | |||
patch-format and nopatch-format styles. This hook is, in concert | patch-format and nopatch-format styles. This hook is, in concert | |||
with set-patch-format, responsible for %-escaping that value for | with set-patch-format, responsible for %-escaping that value for | |||
use in the prompt. (See *Note vcs_info Oddities::.) | use in the prompt. (See *Note vcs_info Oddities::.) | |||
The quilt backend passes to this hook the inputs | ||||
${hook_com[quilt-patches-dir]} and, if it has been determined, | ||||
${hook_com[quilt-pc-dir]}. | ||||
gen-unapplied-string | gen-unapplied-string | |||
Called in the git (with stgit or during rebase), and hg (with mq) | Called in the git (with stgit or during rebase), and hg (with mq) | |||
backend and in quilt support when the unapplied-string is | backend and in quilt support when the unapplied-string is | |||
generated; the get-unapplied style must be true. | generated; the get-unapplied style must be true. | |||
This hook gets the names of all unapplied patches which vcs_info | This hook gets the names of all unapplied patches which vcs_info | |||
collected so far in order, which means that the first argument is | in order, which means that the first argument is the patch | |||
the patch next-in-line to be applied and so forth. | next-in-line to be applied and so forth. | |||
The format of each argument is as for gen-applied-string, above. | ||||
When setting ret to non-zero, the string in | When setting ret to non-zero, the string in | |||
${hook_com[unapplied-string]} will be available as %u in the | ${hook_com[unapplied-string]} will be available as %u in the | |||
patch-format and nopatch-format styles. This hook is, in concert | patch-format and nopatch-format styles. This hook is, in concert | |||
with set-patch-format, responsible for %-escaping that value for | with set-patch-format, responsible for %-escaping that value for | |||
use in the prompt. (See *Note vcs_info Oddities::.) | use in the prompt. (See *Note vcs_info Oddities::.) | |||
The quilt backend passes to this hook the inputs | ||||
${hook_com[quilt-patches-dir]} and, if it has been determined, | ||||
${hook_com[quilt-pc-dir]}. | ||||
gen-mqguards-string | gen-mqguards-string | |||
Called in the hg backend when guards-string is generated; the | Called in the hg backend when guards-string is generated; the | |||
get-mq style must be true (default). | get-mq style must be true (default). | |||
This hook gets the names of any active mq guards. | This hook gets the names of any active mq guards. | |||
When setting ret to non-zero, the string in | When setting ret to non-zero, the string in | |||
${hook_com[guards-string]} will be used in the %g escape in the | ${hook_com[guards-string]} will be used in the %g escape in the | |||
patch-format and nopatch-format styles. | patch-format and nopatch-format styles. | |||
skipping to change at line 3846 | skipping to change at line 3861 | |||
If ret is set to non-zero, the string in ${hook_com[patch-replace]} | If ret is set to non-zero, the string in ${hook_com[patch-replace]} | |||
will be used unchanged instead of an expanded format from | will be used unchanged instead of an expanded format from | |||
patch-format or nopatch-format. | patch-format or nopatch-format. | |||
This hook is, in concert with the gen-applied-string or | This hook is, in concert with the gen-applied-string or | |||
gen-unapplied-string hooks if they are defined, responsible for | gen-unapplied-string hooks if they are defined, responsible for | |||
%-escaping the final patch-format value for use in the prompt. | %-escaping the final patch-format value for use in the prompt. | |||
(See *Note vcs_info Oddities::.) | (See *Note vcs_info Oddities::.) | |||
The quilt backend passes to this hook the inputs | ||||
${hook_com[quilt-patches-dir]} and, if it has been determined, | ||||
${hook_com[quilt-pc-dir]}. | ||||
set-message | set-message | |||
Called each time before a `vcs_info_msg_N_' message is set. It | Called each time before a `vcs_info_msg_N_' message is set. It | |||
takes two arguments; the first being the `N' in the message | takes two arguments; the first being the `N' in the message | |||
variable name, the second is the currently configured formats or | variable name, the second is the currently configured formats or | |||
actionformats. | actionformats. | |||
There are a number of `hook_com' keys, that are used here: | There are a number of `hook_com' keys, that are used here: | |||
`action', `branch', `base', `base-name', `subdir', `staged', | `action', `branch', `base', `base-name', `subdir', `staged', | |||
`unstaged', `revision', `misc', `vcs' and one `miscN' entry for | `unstaged', `revision', `misc', `vcs' and one `miscN' entry for | |||
each backend-specific data field (N starting at zero). They are | each backend-specific data field (N starting at zero). They are | |||
skipping to change at line 3909 | skipping to change at line 3928 | |||
More is possible. See *Note The zsh/zutil Module:: for details. | More is possible. See *Note The zsh/zutil Module:: for details. | |||
Use the quicker bzr backend | Use the quicker bzr backend | |||
zstyle ':vcs_info:bzr:*' use-simple true | zstyle ':vcs_info:bzr:*' use-simple true | |||
If you do use use-simple, please report if it does | If you do use use-simple, please report if it does | |||
`the-right-thing[tm]'. | `the-right-thing[tm]'. | |||
Display the revision number in yellow for bzr and svn: | Display the revision number in yellow for bzr and svn: | |||
zstyle ':vcs_info:(svn|bzr):*' \ | zstyle ':vcs_info:(svn|bzr):*' \ | |||
branchformat '%b%%F{yellow}:%r' | ||||
The doubled percent sign is explained in *Note vcs_info Oddities::. | ||||
Alternatively, one can use the raw colour codes directly: | ||||
zstyle ':vcs_info:(svn|bzr):*' \ | ||||
branchformat '%b%{'${fg[yellow]}'%}:%r' | branchformat '%b%{'${fg[yellow]}'%}:%r' | |||
If you want colors, make sure you enclose the color codes in %{...%} if | Normally when a variable is interpolated into a format string, the | |||
you want to use the string provided by vcs_info in prompts. | variable needs to be %-escaped. In this example we skipped that because | |||
we assume the value of ${fg[yellow]} doesn't contain any % signs. | ||||
Make sure you enclose the color codes in %{...%} if you want to use the | ||||
string provided by vcs_info in prompts. | ||||
Here is how to print the VCS information as a command (not in a prompt): | Here is how to print the VCS information as a command (not in a prompt): | |||
alias vcsi='vcs_info command; vcs_info_lastmsg' | vcsi() { vcs_info interactive; vcs_info_lastmsg } | |||
This way, you can even define different formats for output via | This way, you can even define different formats for output via | |||
vcs_info_lastmsg in the ':vcs_info:*:command:*' namespace. | vcs_info_lastmsg in the ':vcs_info:*:interactive:*' namespace. | |||
Now as promised, some code that uses hooks: say, you'd like to replace | Now as promised, some code that uses hooks: say, you'd like to replace | |||
the string `svn' by `subversion' in vcs_info's %s formats replacement. | the string `svn' by `subversion' in vcs_info's %s formats replacement. | |||
First, we will tell vcs_info to call a function when populating the | First, we will tell vcs_info to call a function when populating the | |||
message variables with the gathered information: | message variables with the gathered information: | |||
zstyle ':vcs_info:*+set-message:*' hooks svn2subversion | zstyle ':vcs_info:*+set-message:*' hooks svn2subversion | |||
Nothing happens. Which is reasonable, since we didn't define the actual | Nothing happens. Which is reasonable, since we didn't define the actual | |||
function yet. To see what the hooks subsystem is trying to do, enable | function yet. To see what the hooks subsystem is trying to do, enable | |||
skipping to change at line 4004 | skipping to change at line 4034 | |||
File: zsh.info, Node: Prompt Themes, Next: ZLE Functions, Prev: Version Contr ol Information, Up: User Contributions | File: zsh.info, Node: Prompt Themes, Next: ZLE Functions, Prev: Version Contr ol Information, Up: User Contributions | |||
26.6 Prompt Themes | 26.6 Prompt Themes | |||
================== | ================== | |||
26.6.1 Installation | 26.6.1 Installation | |||
------------------- | ------------------- | |||
You should make sure all the functions from the Functions/Prompts | You should make sure all the functions from the Functions/Prompts | |||
directory of the source distribution are available; they all begin with | directory of the source distribution are available; they all begin with | |||
the string `prompt_' except for the special function`promptinit'. You | the string `prompt_' except for the special function `promptinit'. You | |||
also need the `colors' and `add-zsh-hook' functions from Functions/Misc. | also need the `colors' and `add-zsh-hook' functions from Functions/Misc. | |||
All these functions may already be installed on your system; if not, | All these functions may already be installed on your system; if not, | |||
you will need to find them and copy them. The directory should appear | you will need to find them and copy them. The directory should appear | |||
as one of the elements of the fpath array (this should already be the | as one of the elements of the fpath array (this should already be the | |||
case if they were installed), and at least the function promptinit | case if they were installed), and at least the function promptinit | |||
should be autoloaded; it will autoload the rest. Finally, to initialize | should be autoloaded; it will autoload the rest. Finally, to initialize | |||
the use of the system you need to call the promptinit function. The | the use of the system you need to call the promptinit function. The | |||
following code in your .zshrc will arrange for this; assume the | following code in your .zshrc will arrange for this; assume the | |||
functions are stored in the directory ~/myfns: | functions are stored in the directory ~/myfns: | |||
skipping to change at line 4108 | skipping to change at line 4138 | |||
setup function may also do any of the following: | setup function may also do any of the following: | |||
Assign prompt_opts | Assign prompt_opts | |||
The array prompt_opts may be assigned any of "bang", "cr", | The array prompt_opts may be assigned any of "bang", "cr", | |||
"percent", "sp", and/or "subst" as values. The corresponding | "percent", "sp", and/or "subst" as values. The corresponding | |||
setopts (promptbang, etc.) are turned on, all other prompt-related | setopts (promptbang, etc.) are turned on, all other prompt-related | |||
options are turned off. The prompt_opts array preserves setopts | options are turned off. The prompt_opts array preserves setopts | |||
even beyond the scope of localoptions, should your function need | even beyond the scope of localoptions, should your function need | |||
that. | that. | |||
Modify precmd and preexec | Modify hooks | |||
Use of add-zsh-hook is recommended. The precmd and preexec hooks | Use of add-zsh-hook and add-zle-hook-widget is recommended (see | |||
are automatically adjusted if the prompt theme changes or is | the `Manipulating Hook Functions' section above). All hooks that | |||
disabled. | follow the naming pattern prompt_THEME_HOOK are automatically | |||
removed when the prompt theme changes or is disabled. | ||||
Declare cleanup | Declare cleanup | |||
If your function makes any other changes that should be undone | If your function makes any other changes that should be undone | |||
when the theme is disabled, your setup function may call | when the theme is disabled, your setup function may call | |||
prompt_cleanup COMMAND | prompt_cleanup COMMAND | |||
where COMMAND should be suitably quoted. If your theme is ever | where COMMAND should be suitably quoted. If your theme is ever | |||
disabled or replaced by another, COMMAND is executed with eval. | disabled or replaced by another, COMMAND is executed with eval. | |||
You may declare more than one such cleanup hook. | You may declare more than one such cleanup hook. | |||
Define preview | Define preview | |||
Define or autoload a function prompt_NAME_preview to display a | Define or autoload a function prompt_NAME_preview to display a | |||
simulated version of your prompt. A simple default previewer is | simulated version of your prompt. A simple default previewer is | |||
defined by promptinit for themes that do not define their own. | defined by promptinit for themes that do not define their own. | |||
This preview function is called by `prompt -p'. | This preview function is called by `prompt -p'. | |||
skipping to change at line 4401 | skipping to change at line 4434 | |||
SUBWORD-RANGE | SUBWORD-RANGE | |||
For example, match-words-by-style -w shell -c 0 may be used to | For example, match-words-by-style -w shell -c 0 may be used to | |||
extract the command argument around the cursor. | extract the command argument around the cursor. | |||
The word-context style is implemented by the function | The word-context style is implemented by the function | |||
match-word-context. This should not usually need to be called | match-word-context. This should not usually need to be called | |||
directly. | directly. | |||
bracketed-paste-magic | bracketed-paste-magic | |||
The bracketed-paste widget (see *Note Miscellaneous:: in *Note Zle | The bracketed-paste widget (see *Note Miscellaneous:: in *Note | |||
Widgets::) inserts pasted text literally into the editor buffer | Standard Widgets::) inserts pasted text literally into the editor | |||
rather than interpret it as keystrokes. This disables some common | buffer rather than interpret it as keystrokes. This disables some | |||
usages where the self-insert widget is replaced in order to | common usages where the self-insert widget is replaced in order to | |||
accomplish some extra processing. An example is the contributed | accomplish some extra processing. An example is the contributed | |||
url-quote-magic widget described below. | url-quote-magic widget described below. | |||
The bracketed-paste-magic widget is meant to replace | The bracketed-paste-magic widget is meant to replace | |||
bracketed-paste with a wrapper that re-enables these self-insert | bracketed-paste with a wrapper that re-enables these self-insert | |||
actions, and other actions as selected by zstyles. Therefore this | actions, and other actions as selected by zstyles. Therefore this | |||
widget is installed with | widget is installed with | |||
autoload -Uz bracketed-paste-magic | autoload -Uz bracketed-paste-magic | |||
zle -N bracketed-paste bracketed-paste-magic | zle -N bracketed-paste bracketed-paste-magic | |||
skipping to change at line 4557 | skipping to change at line 4590 | |||
In this case, however, they search for a line which matches the | In this case, however, they search for a line which matches the | |||
current line up to the current cursor position, in the manner of | current line up to the current cursor position, in the manner of | |||
history-beginning-search-backward and -forward, rather than the | history-beginning-search-backward and -forward, rather than the | |||
first word on the line. | first word on the line. | |||
edit-command-line | edit-command-line | |||
Edit the command line using your visual editor, as in ksh. | Edit the command line using your visual editor, as in ksh. | |||
bindkey -M vicmd v edit-command-line | bindkey -M vicmd v edit-command-line | |||
The editor to be used can also be specified using the editor style | ||||
in the context of the widget. It is specified as an array of | ||||
command and arguments: | ||||
zstyle :zle:edit-command-line editor gvim -f | ||||
expand-absolute-path | expand-absolute-path | |||
Expand the file name under the cursor to an absolute path, | Expand the file name under the cursor to an absolute path, | |||
resolving symbolic links. Where possible, the initial path | resolving symbolic links. Where possible, the initial path | |||
segment is turned into a named directory or reference to a user's | segment is turned into a named directory or reference to a user's | |||
home directory. | home directory. | |||
history-search-end | history-search-end | |||
This function implements the widgets | This function implements the widgets | |||
history-beginning-search-backward-end and | history-beginning-search-backward-end and | |||
history-beginning-search-forward-end. These commands work by first | history-beginning-search-forward-end. These commands work by first | |||
skipping to change at line 5787 | skipping to change at line 5826 | |||
Calling zsh-mime-setup with the option -l lists the existing | Calling zsh-mime-setup with the option -l lists the existing | |||
mappings without altering them. Suffixes to list (which may | mappings without altering them. Suffixes to list (which may | |||
contain pattern characters that should be quoted from immediate | contain pattern characters that should be quoted from immediate | |||
interpretation on the command line) may be given as additional | interpretation on the command line) may be given as additional | |||
arguments, otherwise all suffixes are listed. | arguments, otherwise all suffixes are listed. | |||
Calling zsh-mime-setup with the option -v causes verbose output to | Calling zsh-mime-setup with the option -v causes verbose output to | |||
be shown during the setup operation. | be shown during the setup operation. | |||
The system respects the mailcap flags needsterminal and | The system respects the mailcap flags needsterminal and | |||
copiousoutput, see man page mailcap(4). | copiousoutput; see mailcap(4) or mailcap(5) (the man page's name | |||
varies across platforms). | ||||
The functions use the following styles, which are defined with the | The functions use the following styles, which are defined with the | |||
zstyle builtin command (*Note The zsh/zutil Module::). They | zstyle builtin command (*Note The zsh/zutil Module::). They | |||
should be defined before zsh-mime-setup is run. The contexts used | should be defined before zsh-mime-setup is run. The contexts used | |||
all start with :mime:, with additional components in some cases. | all start with :mime:, with additional components in some cases. | |||
It is recommended that a trailing * (suitably quoted) be appended | It is recommended that a trailing * (suitably quoted) be appended | |||
to style patterns in case the system is extended in future. Some | to style patterns in case the system is extended in future. Some | |||
examples are given below. | examples are given below. | |||
For files that have multiple suffixes, e.g. .pdf.gz, where the | For files that have multiple suffixes, e.g. .pdf.gz, where the | |||
skipping to change at line 6465 | skipping to change at line 6505 | |||
In addition, the scalar parameters reset_color and bold_color are | In addition, the scalar parameters reset_color and bold_color are | |||
set to the ANSI terminal escapes that turn off all attributes and | set to the ANSI terminal escapes that turn off all attributes and | |||
turn on bold intensity, respectively. | turn on bold intensity, respectively. | |||
fned [ -x NUM ] NAME | fned [ -x NUM ] NAME | |||
Same as zed -f. This function does not appear in the zsh | Same as zed -f. This function does not appear in the zsh | |||
distribution, but can be created by linking zed to the name fned | distribution, but can be created by linking zed to the name fned | |||
in some directory in your fpath. | in some directory in your fpath. | |||
histed [ [ NAME ] SIZE ] | ||||
Same as zed -h. This function does not appear in the zsh | ||||
distribution, but can be created by linking zed to the name histed | ||||
in some directory in your fpath. | ||||
is-at-least NEEDED [ PRESENT ] | is-at-least NEEDED [ PRESENT ] | |||
Perform a greater-than-or-equal-to comparison of two strings | Perform a greater-than-or-equal-to comparison of two strings | |||
having the format of a zsh version number; that is, a string of | having the format of a zsh version number; that is, a string of | |||
numbers and text with segments separated by dots or dashes. If | numbers and text with segments separated by dots or dashes. If | |||
the PRESENT string is not provided, $ZSH_VERSION is used. | the PRESENT string is not provided, $ZSH_VERSION is used. | |||
Segments are paired left-to-right in the two strings with leading | Segments are paired left-to-right in the two strings with leading | |||
non-number parts ignored. If one string has fewer segments than | non-number parts ignored. If one string has fewer segments than | |||
the other, the missing segments are considered zero. | the other, the missing segments are considered zero. | |||
This is useful in startup files to set options and other state | This is useful in startup files to set options and other state | |||
skipping to change at line 6494 | skipping to change at line 6539 | |||
exactly like the standard nslookup except that it provides | exactly like the standard nslookup except that it provides | |||
customizable prompts (including a right-side prompt) and | customizable prompts (including a right-side prompt) and | |||
completion of nslookup commands, host names, etc. (if you use the | completion of nslookup commands, host names, etc. (if you use the | |||
function-based completion system). Completion styles may be set | function-based completion system). Completion styles may be set | |||
with the context prefix `:completion:nslookup'. | with the context prefix `:completion:nslookup'. | |||
See also the pager, prompt and rprompt styles below. | See also the pager, prompt and rprompt styles below. | |||
regexp-replace VAR REGEXP REPLACE | regexp-replace VAR REGEXP REPLACE | |||
Use regular expressions to perform a global search and replace | Use regular expressions to perform a global search and replace | |||
operation on a variable. POSIX extended regular expressions are | operation on a variable. POSIX extended regular expressions (ERE) | |||
used, unless the option RE_MATCH_PCRE has been set, in which case | are used, unless the option RE_MATCH_PCRE has been set, in which | |||
Perl-compatible regular expressions are used (this requires the | case Perl-compatible regular expressions are used (this requires | |||
shell to be linked against the pcre library). | the shell to be linked against the pcre library). | |||
VAR is the name of the variable containing the string to be | VAR is the name of the variable containing the string to be | |||
matched. The variable will be modified directly by the function. | matched. The variable will be modified directly by the function. | |||
The variables MATCH, MBEGIN, MEND, match, mbegin, mend should be | The variables MATCH, MBEGIN, MEND, match, mbegin, mend should be | |||
avoided as these are used by the regular expression code. | avoided as these are used by the regular expression code. | |||
REGEXP is the regular expression to match against the string. | REGEXP is the regular expression to match against the string. | |||
REPLACE is the replacement text. This can contain parameter, | REPLACE is the replacement text. This can contain parameter, | |||
command and arithmetic expressions which will be replaced: in | command and arithmetic expressions which will be replaced: in | |||
particular, a reference to $MATCH will be replaced by the text | particular, a reference to $MATCH will be replaced by the text | |||
matched by the pattern. | matched by the pattern. | |||
The return status is 0 if at least one match was performed, else 1. | The return status is 0 if at least one match was performed, else 1. | |||
Note that if using POSIX EREs, the ^ or word boundary operators | ||||
(where available) may not work properly. | ||||
run-help CMD | run-help CMD | |||
This function is designed to be invoked by the run-help ZLE widget, | This function is designed to be invoked by the run-help ZLE widget, | |||
in place of the default alias. See `Accessing On-Line Help' | in place of the default alias. See `Accessing On-Line Help' | |||
(*Note Utilities::) for setup instructions. | (*Note Utilities::) for setup instructions. | |||
In the discussion which follows, if CMD is a file system path, it | In the discussion which follows, if CMD is a file system path, it | |||
is first reduced to its rightmost component (the file name). | is first reduced to its rightmost component (the file name). | |||
Help is first sought by looking for a file named CMD in the | Help is first sought by looking for a file named CMD in the | |||
directory named by the HELPDIR parameter. If no file is found, an | directory named by the HELPDIR parameter. If no file is found, an | |||
skipping to change at line 6550 | skipping to change at line 6598 | |||
else | else | |||
run-help $args[2] | run-help $args[2] | |||
fi | fi | |||
} | } | |||
Several of these assistants are provided in the Functions/Misc | Several of these assistants are provided in the Functions/Misc | |||
directory. These must be autoloaded, or placed as executable | directory. These must be autoloaded, or placed as executable | |||
scripts in your search path, in order to be found and used by | scripts in your search path, in order to be found and used by | |||
run-help. | run-help. | |||
run-help-btrfs | ||||
run-help-git | run-help-git | |||
run-help-ip | run-help-ip | |||
run-help-openssl | run-help-openssl | |||
run-help-p4 | run-help-p4 | |||
run-help-sudo | run-help-sudo | |||
run-help-svk | run-help-svk | |||
run-help-svn | run-help-svn | |||
Assistant functions for the git, ip, openssl, p4, sudo, svk, | Assistant functions for the btrfs, git, ip, openssl, p4, sudo, | |||
and svn, commands. | svk, and svn, commands. | |||
tetris | tetris | |||
Zsh was once accused of not being as complete as Emacs, because it | Zsh was once accused of not being as complete as Emacs, because it | |||
lacked a Tetris game. This function was written to refute this | lacked a Tetris game. This function was written to refute this | |||
vicious slander. | vicious slander. | |||
This function must be used as a ZLE widget: | This function must be used as a ZLE widget: | |||
autoload -U tetris | autoload -U tetris | |||
zle -N tetris | zle -N tetris | |||
skipping to change at line 6645 | skipping to change at line 6694 | |||
This is a good choice in that example because no plain file can be | This is a good choice in that example because no plain file can be | |||
named `..', but the best end-marker depends on the circumstances. | named `..', but the best end-marker depends on the circumstances. | |||
The options -i, -I, -l, -L, and -n differ slightly from their | The options -i, -I, -l, -L, and -n differ slightly from their | |||
usage in xargs. There are no input lines for zargs to count, so | usage in xargs. There are no input lines for zargs to count, so | |||
-l and -L count through the INPUT list, and -n counts the number | -l and -L count through the INPUT list, and -n counts the number | |||
of arguments passed to each execution of COMMAND, _including_ any | of arguments passed to each execution of COMMAND, _including_ any | |||
ARG list. Also, any time -i or -I is used, each INPUT is | ARG list. Also, any time -i or -I is used, each INPUT is | |||
processed separately as if by `-L 1'. | processed separately as if by `-L 1'. | |||
For details of the other zargs options, see man page xargs(1) (but | For details of the other zargs options, see the xargs(1) man page | |||
note the difference in function between zargs and xargs) or run | (but note the difference in function between zargs and xargs) or | |||
zargs with the --help option. | run zargs with the --help option. | |||
zed [ -f [ -x NUM ] ] NAME | zed [ -f [ -x NUM ] ] NAME | |||
zed [ -h [ NAME ] SIZE ] | ||||
zed -b | zed -b | |||
This function uses the ZLE editor to edit a file or function. | This function uses the ZLE editor to edit a file or function. | |||
Only one NAME argument is allowed. If the -f option is given, the | Only one NAME argument is allowed. If the -f option is given, the | |||
name is taken to be that of a function; if the function is marked | name is taken to be that of a function; if the function is marked | |||
for autoloading, zed searches for it in the fpath and loads it. | for autoloading, zed searches for it in the fpath and loads it. | |||
Note that functions edited this way are installed into the current | Note that functions edited this way are installed into the current | |||
shell, but _not_ written back to the autoload file. In this case | shell, but _not_ written back to the autoload file. In this case | |||
the -x option specifies that leading tabs indenting the function | the -x option specifies that leading tabs indenting the function | |||
according to syntax should be converted into the given number of | according to syntax should be converted into the given number of | |||
spaces; `-x 2' is consistent with the layout of functions | spaces; `-x 2' is consistent with the layout of functions | |||
distributed with the shell. | distributed with the shell. | |||
Without -f, NAME is the path name of the file to edit, which need | Without -f, NAME is the path name of the file to edit, which need | |||
not exist; it is created on write, if necessary. | not exist; it is created on write, if necessary. With -h, the | |||
file is presumed to contain history events. | ||||
When no file name is provided for -h the current shell history is | ||||
edited in place. The history is renumbered when zed exits | ||||
successfully. | ||||
When editing history, multi-line events must have a trailing | ||||
backslash on every line before the last. | ||||
While editing, the function sets the main keymap to zed and the vi | While editing, the function sets the main keymap to zed and the vi | |||
command keymap to zed-vicmd. These will be copied from the | command keymap to zed-vicmd. These will be copied from the | |||
existing main and vicmd keymaps if they do not exist the first | existing main and vicmd keymaps if they do not exist the first | |||
time zed is run. They can be used to provide special key bindings | time zed is run. They can be used to provide special key bindings | |||
used only in zed. | used only in zed. | |||
If it creates the keymap, zed rebinds the return key to insert a | If it creates the keymap, zed rebinds the return key to insert a | |||
line break and `^X^W' to accept the edit in the zed keymap, and | line break and `^X^W' to accept the edit in the zed keymap, and | |||
binds `ZZ' to accept the edit in the zed-vicmd keymap. | binds `ZZ' to accept the edit in the zed-vicmd keymap. | |||
The bindings alone can be installed by running `zed -b'. This is | The bindings alone can be installed by running `zed -b'. This is | |||
suitable for putting into a startup file. Note that, if rerun, | suitable for putting into a startup file. Note that, if rerun, | |||
this will overwrite the existing zed and zed-vicmd keymaps. | this will overwrite the existing zed and zed-vicmd keymaps. | |||
Completion is available, and styles may be set with the context | Completion is available, and styles may be set with the context | |||
prefix `:completion:zed'. | prefix `:completion:zed:'. | |||
A zle widget zed-set-file-name is available. This can be called by | A zle widget zed-set-file-name is available. This can be called | |||
name from within zed using `\ex zed-set-file-name' (note, however, | by name from within zed using `\ex zed-set-file-name' or can be | |||
that because of zed's rebindings you will have to type ^j at the | bound to a key in either of the zed or zed-vicmd keymaps after | |||
end instead of the return key), or can be bound to a key in either | `zed -b' has been run. When the widget is called, it prompts for | |||
of the zed or zed-vicmd keymaps after `zed -b' has been run. When | a new name for the file being edited. When zed exits the file | |||
the widget is called, it prompts for a new name for the file being | will be written under that name and the original file will be left | |||
edited. When zed exits the file will be written under that name | alone. The widget has no effect when invoked from `zed -f'. The | |||
and the original file will be left alone. The widget has no | completion context is changed to `:completion:zed-set-file-name:'. | |||
effect with `zed -f'. | When editing the current history with `zed -h', the history is | |||
first updated and then the file is written, but the global setting | ||||
of HISTFILE is not altered. | ||||
While zed-set-file-name is running, zed uses the keymap | While zed-set-file-name is running, zed uses the keymap | |||
zed-normal-keymap, which is linked from the main keymap in effect | zed-normal-keymap, which is linked from the main keymap in effect | |||
at the time zed initialised its bindings. (This is to make the | at the time zed initialised its bindings. (This is to make the | |||
return key operate normally.) The result is that if the main | return key operate normally.) The result is that if the main | |||
keymap has been changed, the widget won't notice. This is not a | keymap has been changed, the widget won't notice. This is not a | |||
concern for most users. | concern for most users. | |||
zcp [ -finqQvwW ] SRCPAT DEST | zcp [ -finqQvwW ] SRCPAT DEST | |||
zln [ -finqQsvwW ] SRCPAT DEST | zln [ -finqQsvwW ] SRCPAT DEST | |||
skipping to change at line 6728 | skipping to change at line 6788 | |||
renames `foo.lis' to `foo.txt', `my.old.stuff.lis' to | renames `foo.lis' to `foo.txt', `my.old.stuff.lis' to | |||
`my.old.stuff.txt', and so on. | `my.old.stuff.txt', and so on. | |||
The pattern is always treated as an EXTENDED_GLOB pattern. Any | The pattern is always treated as an EXTENDED_GLOB pattern. Any | |||
file whose name is not changed by the substitution is simply | file whose name is not changed by the substitution is simply | |||
ignored. Any error (a substitution resulted in an empty string, | ignored. Any error (a substitution resulted in an empty string, | |||
two substitutions gave the same result, the destination was an | two substitutions gave the same result, the destination was an | |||
existing regular file and -f was not given) causes the entire | existing regular file and -f was not given) causes the entire | |||
function to abort without doing anything. | function to abort without doing anything. | |||
In addition to pattern replacement, the variable $f can be | In addition to pattern replacement, the variable $f can be referred | |||
referrred to in the second (replacement) argument. This makes it | to in the second (replacement) argument. This makes it possible to | |||
possible to use variable substitution to alter the argument; see | use variable substitution to alter the argument; see examples | |||
examples below. | below. | |||
Options: | Options: | |||
-f | -f | |||
Force overwriting of destination files. Not currently passed | Force overwriting of destination files. Not currently passed | |||
down to the mv/cp/ln command due to vagaries of | down to the mv/cp/ln command due to vagaries of | |||
implementations (but you can use -o-f to do that). | implementations (but you can use -o-f to do that). | |||
-i | -i | |||
Interactive: show each line to be executed and ask the user | Interactive: show each line to be executed and ask the user | |||
End of changes. 43 change blocks. | ||||
78 lines changed or deleted | 138 lines changed or added |