982 lines
48 KiB
HTML
982 lines
48 KiB
HTML
<!DOCTYPE HTML>
|
||
<html lang="en" class="sidebar-visible no-js light">
|
||
<head>
|
||
<!-- Book generated using mdBook -->
|
||
<meta charset="UTF-8">
|
||
<title>Completion Using compctl - Zsh Manual</title>
|
||
|
||
|
||
|
||
|
||
<!-- Custom HTML head -->
|
||
|
||
|
||
|
||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||
<meta name="description" content="">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<meta name="theme-color" content="#ffffff" />
|
||
|
||
|
||
<link rel="icon" href="favicon.svg">
|
||
|
||
|
||
<link rel="shortcut icon" href="favicon.png">
|
||
|
||
<link rel="stylesheet" href="css/variables.css">
|
||
<link rel="stylesheet" href="css/general.css">
|
||
<link rel="stylesheet" href="css/chrome.css">
|
||
|
||
<link rel="stylesheet" href="css/print.css" media="print">
|
||
|
||
|
||
<!-- Fonts -->
|
||
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
|
||
|
||
<link rel="stylesheet" href="fonts/fonts.css">
|
||
|
||
|
||
<!-- Highlight.js Stylesheets -->
|
||
<link rel="stylesheet" href="highlight.css">
|
||
<link rel="stylesheet" href="tomorrow-night.css">
|
||
<link rel="stylesheet" href="ayu-highlight.css">
|
||
|
||
<!-- Custom theme stylesheets -->
|
||
|
||
|
||
|
||
</head>
|
||
<body>
|
||
<!-- Provide site root to javascript -->
|
||
<script type="text/javascript">
|
||
var path_to_root = "";
|
||
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
|
||
</script>
|
||
|
||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||
<script type="text/javascript">
|
||
try {
|
||
var theme = localStorage.getItem('mdbook-theme');
|
||
var sidebar = localStorage.getItem('mdbook-sidebar');
|
||
|
||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
||
}
|
||
|
||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||
}
|
||
} catch (e) { }
|
||
</script>
|
||
|
||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||
<script type="text/javascript">
|
||
var theme;
|
||
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||
var html = document.querySelector('html');
|
||
html.classList.remove('no-js')
|
||
html.classList.remove('light')
|
||
html.classList.add(theme);
|
||
html.classList.add('js');
|
||
</script>
|
||
|
||
<!-- Hide / unhide sidebar before it is displayed -->
|
||
<script type="text/javascript">
|
||
var html = document.querySelector('html');
|
||
var sidebar = 'hidden';
|
||
if (document.body.clientWidth >= 1080) {
|
||
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
||
sidebar = sidebar || 'visible';
|
||
}
|
||
html.classList.remove('sidebar-visible');
|
||
html.classList.add("sidebar-" + sidebar);
|
||
</script>
|
||
|
||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||
<div class="sidebar-scrollbox">
|
||
<ol class="chapter"><li class="chapter-item expanded "><a href="The-Z-Shell-Manual.html"><strong aria-hidden="true">1.</strong> The Z Shell Manual</a></li><li class="chapter-item expanded "><a href="Introduction.html"><strong aria-hidden="true">2.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="Roadmap.html"><strong aria-hidden="true">3.</strong> Roadmap</a></li><li class="chapter-item expanded "><a href="Invocation.html"><strong aria-hidden="true">4.</strong> Invocation</a></li><li class="chapter-item expanded "><a href="Files.html"><strong aria-hidden="true">5.</strong> Files</a></li><li class="chapter-item expanded "><a href="Shell-Grammar.html"><strong aria-hidden="true">6.</strong> Shell Grammar</a></li><li class="chapter-item expanded "><a href="Redirection.html"><strong aria-hidden="true">7.</strong> Redirection</a></li><li class="chapter-item expanded "><a href="Command-Execution.html"><strong aria-hidden="true">8.</strong> Command Execution</a></li><li class="chapter-item expanded "><a href="Functions.html"><strong aria-hidden="true">9.</strong> Functions</a></li><li class="chapter-item expanded "><a href="Jobs-_0026-Signals.html"><strong aria-hidden="true">10.</strong> Jobs & Signals</a></li><li class="chapter-item expanded "><a href="Arithmetic-Evaluation.html"><strong aria-hidden="true">11.</strong> Arithmetic Evaluation</a></li><li class="chapter-item expanded "><a href="Conditional-Expressions.html"><strong aria-hidden="true">12.</strong> Conditional Expressions</a></li><li class="chapter-item expanded "><a href="Prompt-Expansion.html"><strong aria-hidden="true">13.</strong> Prompt Expansion</a></li><li class="chapter-item expanded "><a href="Expansion.html"><strong aria-hidden="true">14.</strong> Expansion</a></li><li class="chapter-item expanded "><a href="Parameters.html"><strong aria-hidden="true">15.</strong> Parameters</a></li><li class="chapter-item expanded "><a href="Options.html"><strong aria-hidden="true">16.</strong> Options</a></li><li class="chapter-item expanded "><a href="Shell-Builtin-Commands.html"><strong aria-hidden="true">17.</strong> Shell Builtin Commands</a></li><li class="chapter-item expanded "><a href="Zsh-Line-Editor.html"><strong aria-hidden="true">18.</strong> Zsh Line Editor</a></li><li class="chapter-item expanded "><a href="Completion-Widgets.html"><strong aria-hidden="true">19.</strong> Completion Widgets</a></li><li class="chapter-item expanded "><a href="Completion-System.html"><strong aria-hidden="true">20.</strong> Completion System</a></li><li class="chapter-item expanded "><a href="Completion-Using-compctl.html" class="active"><strong aria-hidden="true">21.</strong> Completion Using compctl</a></li><li class="chapter-item expanded "><a href="Zsh-Modules.html"><strong aria-hidden="true">22.</strong> Zsh Modules</a></li><li class="chapter-item expanded "><a href="Calendar-Function-System.html"><strong aria-hidden="true">23.</strong> Calendar Function System</a></li><li class="chapter-item expanded "><a href="TCP-Function-System.html"><strong aria-hidden="true">24.</strong> TCP Function System</a></li><li class="chapter-item expanded "><a href="Zftp-Function-System.html"><strong aria-hidden="true">25.</strong> Zftp Function System</a></li><li class="chapter-item expanded "><a href="User-Contributions.html"><strong aria-hidden="true">26.</strong> User Contributions</a></li></ol>
|
||
</div>
|
||
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
|
||
</nav>
|
||
|
||
<div id="page-wrapper" class="page-wrapper">
|
||
|
||
<div class="page">
|
||
|
||
<div id="menu-bar-hover-placeholder"></div>
|
||
<div id="menu-bar" class="menu-bar sticky bordered">
|
||
<div class="left-buttons">
|
||
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
||
<i class="fa fa-bars"></i>
|
||
</button>
|
||
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
||
<i class="fa fa-paint-brush"></i>
|
||
</button>
|
||
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
||
<li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
||
</ul>
|
||
|
||
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
||
<i class="fa fa-search"></i>
|
||
</button>
|
||
|
||
</div>
|
||
|
||
<h1 class="menu-title">Zsh Manual</h1>
|
||
|
||
<div class="right-buttons">
|
||
|
||
<a href="print.html" title="Print this book" aria-label="Print this book">
|
||
<i id="print-button" class="fa fa-print"></i>
|
||
</a>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div id="search-wrapper" class="hidden">
|
||
<form id="searchbar-outer" class="searchbar-outer">
|
||
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
||
</form>
|
||
<div id="searchresults-outer" class="searchresults-outer hidden">
|
||
<div id="searchresults-header" class="searchresults-header"></div>
|
||
<ul id="searchresults">
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
||
<script type="text/javascript">
|
||
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
||
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
||
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
||
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
||
});
|
||
</script>
|
||
|
||
<div id="content" class="content">
|
||
<main>
|
||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||
<p><strong>Table of Contents</strong> <em>generated with <a href="https://github.com/thlorenz/doctoc">DocToc</a></em></p>
|
||
<ul>
|
||
<li><a href="#21-completion-using-compctl">21 Completion Using compctl</a>
|
||
<ul>
|
||
<li><a href="#211-types-of-completion">21.1 Types of completion</a></li>
|
||
<li><a href="#212-description">21.2 Description</a></li>
|
||
<li><a href="#213-command-flags">21.3 Command Flags</a></li>
|
||
<li><a href="#214-option-flags">21.4 Option Flags</a>
|
||
<ul>
|
||
<li><a href="#2141-simple-flags">21.4.1 Simple Flags</a></li>
|
||
<li><a href="#2142-flags-with-arguments">21.4.2 Flags with Arguments</a></li>
|
||
<li><a href="#2143-control-flags">21.4.3 Control Flags</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="#215-alternative-completion">21.5 Alternative Completion</a></li>
|
||
<li><a href="#216-extended-completion">21.6 Extended Completion</a></li>
|
||
<li><a href="#217-example">21.7 Example</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||
<p><span id="Completion-Using-compctl"></span>
|
||
<span id="Completion-Using-compctl-1"></span></p>
|
||
<h1 id="21-completion-using-compctl"><a class="header" href="#21-completion-using-compctl">21 Completion Using compctl</a></h1>
|
||
<p><span id="index-completion_002c-programmable-2"></span>
|
||
<span id="index-completion_002c-controlling-2"></span></p>
|
||
<hr />
|
||
<p><span id="Types-of-completion"></span></p>
|
||
<h2 id="211-types-of-completion"><a class="header" href="#211-types-of-completion">21.1 Types of completion</a></h2>
|
||
<p>This version of zsh has two ways of performing completion of words on
|
||
the command line. New users of the shell may prefer to use the newer and
|
||
more powerful system based on shell functions; this is described in
|
||
<a href="Completion-System.html#Completion-System">Completion System</a>, and the
|
||
basic shell mechanisms which support it are described in <a href="Completion-Widgets.html#Completion-Widgets">Completion
|
||
Widgets</a>. This chapter
|
||
describes the older <code>compctl</code> command.</p>
|
||
<hr />
|
||
<p><span id="Description-7"></span></p>
|
||
<h2 id="212-description"><a class="header" href="#212-description">21.2 Description</a></h2>
|
||
<p><span id="index-compctl"></span></p>
|
||
<p><code>compctl</code> [ <code>-CDT</code> ] <code>options</code> [ <code>command</code> ... ]</p>
|
||
<p><code>compctl </code>[ <code>-CDT</code> ] <code>options</code> [ <code>-x</code> <code>pattern</code> <code>options</code> <code>-</code> ...
|
||
<code>-``-</code> ]</p>
|
||
<p><code> </code>[ <code>+</code> <code>options</code> [ <code>-x</code> ... <code>-``-</code> ] ... [<code>+</code>] ] [
|
||
<code>command</code> ... ]</p>
|
||
<p><code>compctl</code> <code>-M</code> <code>match-specs</code> ...</p>
|
||
<p><code>compctl</code> <code>-L</code> [ <code>-CDTM</code> ] [ <code>command</code> ... ]</p>
|
||
<p><code>compctl</code> <code>+</code> <code>command</code> ...</p>
|
||
<p>Control the editor’s completion behavior according to the supplied set
|
||
of <code>options</code>. Various editing commands, notably
|
||
<code>expand-or-complete-word</code>, usually bound to tab, will attempt to
|
||
complete a word typed by the user, while others, notably
|
||
<code>delete-char-or-list</code>, usually bound to ^D in EMACS editing mode, list
|
||
the possibilities; <code>compctl</code> controls what those possibilities are. They
|
||
may for example be filenames (the most common case, and hence the
|
||
default), shell variables, or words from a user-specified list.</p>
|
||
<hr />
|
||
<p><span id="Command-Flags"></span> <span id="Command-Flags-1"></span></p>
|
||
<h2 id="213-command-flags"><a class="header" href="#213-command-flags">21.3 Command Flags</a></h2>
|
||
<p>Completion of the arguments of a command may be different for each
|
||
command or may use the default. The behavior when completing the command
|
||
word itself may also be separately specified. These correspond to the
|
||
following flags and arguments, all of which (except for <code>-L</code>) may be
|
||
combined with any combination of the <code>options</code> described subsequently in
|
||
<a href="#Option-Flags">Option Flags</a>:</p>
|
||
<ul>
|
||
<li>
|
||
<p><code>command</code> ...<br />
|
||
controls completion for the named commands, which must be listed
|
||
last on the command line. If completion is attempted for a command
|
||
with a pathname containing slashes and no completion definition is
|
||
found, the search is retried with the last pathname component. If
|
||
the command starts with a <code>=</code>, completion is tried with the pathname
|
||
of the command.</p>
|
||
<p>Any of the <code>command</code> strings may be patterns of the form normally
|
||
used for filename generation. These should be quoted to protect them
|
||
from immediate expansion; for example the command string <code>’foo*’</code>
|
||
arranges for completion of the words of any command beginning with
|
||
<code>foo</code>. When completion is attempted, all pattern completions are
|
||
tried in the reverse order of their definition until one matches. By
|
||
default, completion then proceeds as normal, i.e. the shell will try
|
||
to generate more matches for the specific command on the command
|
||
line; this can be overridden by including <code>-tn</code> in the flags for the
|
||
pattern completion.</p>
|
||
<p>Note that aliases are expanded before the command name is determined
|
||
unless the <code>COMPLETE_ALIASES</code> option is set. Commands may not be
|
||
combined with the <code>-C</code>, <code>-D</code> or <code>-T</code> flags.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-C</code><br />
|
||
controls completion when the command word itself is being completed.
|
||
If no <code>compctl -C</code> command has been issued, the names of any as
|
||
aliases or functions) are completed.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-D</code><br />
|
||
controls default completion behavior for the arguments of commands
|
||
not assigned any special behavior. If no <code>compctl -D</code> command has
|
||
been issued, filenames are completed.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-T</code><br />
|
||
supplies completion flags to be used before any other processing is
|
||
done, even before processing for <code>compctl</code>s defined for specific
|
||
commands. This is especially useful when combined with extended
|
||
completion (the <code>-x</code> flag, see <a href="#Extended-Completion">Extended
|
||
Completion</a> below). Using this flag you can
|
||
define default behavior which will apply to all commands without
|
||
exception, or you can alter the standard behavior for all commands.
|
||
For example, if your access to the user database is too slow and/or
|
||
it contains too many users (so that completion after ‘<code>~</code>’ is too
|
||
slow to be usable), you can use</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -T -x 's[~] C[0,[^/]#]' -k friends -S/ -tn
|
||
</code></pre>
|
||
</div>
|
||
<p>to complete the strings in the array <code>friends</code> after a ‘<code>~</code>’. The
|
||
<code>C[``...``]</code> argument is necessary so that this form of
|
||
<code>~</code>-completion is not tried after the directory name is finished.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-L</code><br />
|
||
<em>no argument</em><br />
|
||
If no argument is given, <code>compctl</code> lists all defined completions in
|
||
an abbreviated form; with a list of <code>options</code>, all completions with
|
||
those flags set (not counting extended completion) are listed.</p>
|
||
</li>
|
||
</ul>
|
||
<p>If the <code>+</code> flag is alone and followed immediately by the <code>command</code> list,
|
||
the completion behavior for all the commands in the list is reset to the
|
||
default. In other words, completion will subsequently use the options
|
||
specified by the <code>-D</code> flag.</p>
|
||
<p>The form with <code>-M</code> as the first and only option defines global matching
|
||
specifications (see <a href="Completion-Widgets.html#Completion-Matching-Control">Completion Matching
|
||
Control</a>). The
|
||
match specifications given will be used for every completion attempt
|
||
(only when using <code>compctl</code>, not with the new completion system) and are
|
||
tried in the order in which they are defined until one generates at
|
||
least one match. E.g.:</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -M '' 'm:{a-zA-Z}={A-Za-z}'
|
||
</code></pre>
|
||
</div>
|
||
<p>This will first try completion without any global match specifications
|
||
(the empty string) and, if that generates no matches, will try case
|
||
insensitive completion.</p>
|
||
<hr />
|
||
<p><span id="Option-Flags"></span> <span id="Option-Flags-1"></span></p>
|
||
<h2 id="214-option-flags"><a class="header" href="#214-option-flags">21.4 Option Flags</a></h2>
|
||
<p>[ <code>-fcFBdeaRGovNAIOPZEnbjrzu/12</code> ]</p>
|
||
<p>[ <code>-k</code> <code>array</code> ] [ <code>-g</code> <code>globstring</code> ] [ <code>-s</code> <code>subststring</code> ]</p>
|
||
<p>[ <code>-K</code> <code>function</code> ]</p>
|
||
<p>[ <code>-Q</code> ] [ <code>-P</code> <code>prefix</code> ] [ <code>-S</code> <code>suffix</code> ]</p>
|
||
<p>[ <code>-W</code> <code>file-prefix</code> ] [ <code>-H</code> <code>num pattern</code> ]</p>
|
||
<p>[ <code>-q</code> ] [ <code>-X</code> <code>explanation</code> ] [ <code>-Y</code> <code>explanation</code> ]</p>
|
||
<p>[ <code>-y</code> <code>func-or-var</code> ] [ <code>-l</code> <code>cmd</code> ] [ <code>-h</code> <code>cmd</code> ] [ <code>-U</code> ]</p>
|
||
<p>[ <code>-t</code> <code>continue</code> ] [ <code>-J</code> <code>name</code> ] [ <code>-V</code> <code>name</code> ]</p>
|
||
<p>[ <code>-M</code> <code>match-spec</code> ]</p>
|
||
<p>The remaining <code>options</code> specify the type of command arguments to look
|
||
for during completion. Any combination of these flags may be specified;
|
||
the result is a sorted list of all the possibilities. The options are as
|
||
follows.</p>
|
||
<hr />
|
||
<p><span id="Simple-Flags"></span> <span id="Simple-Flags-1"></span></p>
|
||
<h3 id="2141-simple-flags"><a class="header" href="#2141-simple-flags">21.4.1 Simple Flags</a></h3>
|
||
<p>These produce completion lists made up by the shell itself:</p>
|
||
<ul>
|
||
<li>
|
||
<p><code>-f</code><br />
|
||
Filenames and file system paths.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-/</code><br />
|
||
Just file system paths.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-c</code><br />
|
||
Command names, including aliases, shell functions, builtins and
|
||
reserved words.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-F</code><br />
|
||
Function names.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-B</code><br />
|
||
Names of builtin commands.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-m</code><br />
|
||
Names of external commands.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-w</code><br />
|
||
Reserved words.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-a</code><br />
|
||
Alias names.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-R</code><br />
|
||
Names of regular (non-global) aliases.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-G</code><br />
|
||
Names of global aliases.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-d</code><br />
|
||
This can be combined with <code>-F</code>, <code>-B</code>, <code>-w</code>, <code>-a</code>, <code>-R</code> and <code>-G</code> to
|
||
get names of disabled functions, builtins, reserved words or
|
||
aliases.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-e</code><br />
|
||
This option (to show enabled commands) is in effect by default, but
|
||
may be combined with <code>-d</code>; <code>-de</code> in combination with <code>-F</code>, <code>-B</code>,
|
||
<code>-w</code>, <code>-a</code>, <code>-R</code> and <code>-G</code> will complete names of functions,
|
||
builtins, reserved words or aliases whether or not they are
|
||
disabled.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-o</code><br />
|
||
Names of shell options (see <a href="Options.html#Options">Options</a>).</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-v</code><br />
|
||
Names of any variable defined in the shell.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-N</code><br />
|
||
Names of scalar (non-array) parameters.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-A</code><br />
|
||
Array names.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-I</code><br />
|
||
Names of integer variables.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-O</code><br />
|
||
Names of read-only variables.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-p</code><br />
|
||
Names of parameters used by the shell (including special
|
||
parameters).</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-Z</code><br />
|
||
Names of shell special parameters.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-E</code><br />
|
||
Names of environment variables.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-n</code><br />
|
||
Named directories.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-b</code><br />
|
||
Key binding names.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-j</code><br />
|
||
Job names: the first word of the job leader’s command line. This is
|
||
useful with the <code>kill</code> builtin.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-r</code><br />
|
||
Names of running jobs.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-z</code><br />
|
||
Names of suspended jobs.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-u</code><br />
|
||
User names.</p>
|
||
</li>
|
||
</ul>
|
||
<hr />
|
||
<p><span id="Flags-with-Arguments"></span>
|
||
<span id="Flags-with-Arguments-1"></span></p>
|
||
<h3 id="2142-flags-with-arguments"><a class="header" href="#2142-flags-with-arguments">21.4.2 Flags with Arguments</a></h3>
|
||
<p>These have user supplied arguments to determine how the list of
|
||
completions is to be made up:</p>
|
||
<ul>
|
||
<li>
|
||
<p><code>-k</code> <code>array</code><br />
|
||
Names taken from the elements of <code>$``array</code> (note that the ‘<code>$</code>’
|
||
does not appear on the command line). Alternatively, the argument
|
||
<code>array</code> itself may be a set of space- or comma-separated values in
|
||
parentheses, in which any delimiter may be escaped with a backslash;
|
||
in this case the argument should be quoted. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -k "(cputime filesize datasize stacksize
|
||
coredumpsize resident descriptors)" limit
|
||
</code></pre>
|
||
</div>
|
||
</li>
|
||
<li>
|
||
<p><code>-g</code> <code>globstring</code><br />
|
||
The <code>globstring</code> is expanded using filename globbing; it should be
|
||
quoted to protect it from immediate expansion. The resulting
|
||
filenames are taken as the possible completions. Use ‘<code>*(/)</code>’
|
||
instead of ‘<code>*/</code>’ for directories. The <code>fignore</code> special parameter
|
||
is not applied to the resulting files. More than one pattern may be
|
||
given separated by blanks. (Note that brace expansion is <em>not</em> part
|
||
of globbing. Use the syntax ‘<code>(either|or)</code>’ to match alternatives.)</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-s</code> <code>subststring</code><br />
|
||
The <code>subststring</code> is split into words and these words are than
|
||
expanded using all shell expansion mechanisms (see
|
||
<a href="Expansion.html#Expansion">Expansion</a>). The resulting words are
|
||
taken as possible completions. The <code>fignore</code> special parameter is
|
||
not applied to the resulting files. Note that <code>-g</code> is faster for
|
||
filenames.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-K</code> <code>function</code><br />
|
||
<span id="index-reply_002c-use-of-2"></span></p>
|
||
<p>Call the given function to get the completions. Unless the name
|
||
starts with an underscore, the function is passed two arguments: the
|
||
prefix and the suffix of the word on which completion is to be
|
||
attempted, in other words those characters before the cursor
|
||
position, and those from the cursor position onwards. The whole
|
||
command line can be accessed with the <code>-c</code> and <code>-l</code> flags of the
|
||
<code>read</code> builtin. The function should set the variable <code>reply</code> to an
|
||
array containing the completions (one completion per element); note
|
||
that <code>reply</code> should not be made local to the function. From such a
|
||
function the command line can be accessed with the <code>-c</code> and <code>-l</code>
|
||
flags to the <code>read</code> builtin. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">function whoson { reply=(`users`); }
|
||
compctl -K whoson talk
|
||
</code></pre>
|
||
</div>
|
||
<p>completes only logged-on users after ‘<code>talk</code>’. Note that ‘<code>whoson</code>’
|
||
must return an array, so ‘<code>reply=‘users‘</code>’ would be incorrect.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-H</code> <code>num pattern</code><br />
|
||
The possible completions are taken from the last <code>num</code> history
|
||
lines. Only words matching <code>pattern</code> are taken. If <code>num</code> is zero or
|
||
negative the whole history is searched and if <code>pattern</code> is the empty
|
||
string all words are taken (as with ‘<code>*</code>’). A typical use is</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -D -f + -H 0 ''
|
||
</code></pre>
|
||
</div>
|
||
<p>which forces completion to look back in the history list for a word
|
||
if no filename matches.</p>
|
||
</li>
|
||
</ul>
|
||
<hr />
|
||
<p><span id="Control-Flags"></span> <span id="Control-Flags-1"></span></p>
|
||
<h3 id="2143-control-flags"><a class="header" href="#2143-control-flags">21.4.3 Control Flags</a></h3>
|
||
<p>These do not directly specify types of name to be completed, but
|
||
manipulate the options that do:</p>
|
||
<ul>
|
||
<li>
|
||
<p><code>-Q</code><br />
|
||
This instructs the shell not to quote any metacharacters in the
|
||
possible completions. Normally the results of a completion are
|
||
inserted into the command line with any metacharacters quoted so
|
||
that they are interpreted as normal characters. This is appropriate
|
||
for filenames and ordinary strings. However, for special effects,
|
||
such as inserting a backquoted expression from a completion array
|
||
(<code>-k</code>) so that the expression will not be evaluated until the
|
||
complete line is executed, this option must be used.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-P</code> <code>prefix</code><br />
|
||
The <code>prefix</code> is inserted just before the completed string; any
|
||
initial part already typed will be completed and the whole <code>prefix</code>
|
||
ignored for completion purposes. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -j -P "%" kill
|
||
</code></pre>
|
||
</div>
|
||
<p>inserts a ‘%’ after the kill command and then completes job names.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-S</code> <code>suffix</code><br />
|
||
When a completion is found the <code>suffix</code> is inserted after the
|
||
completed string. In the case of menu completion the suffix is
|
||
inserted immediately, but it is still possible to cycle through the
|
||
list of completions by repeatedly hitting the same key.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-W</code> <code>file-prefix</code><br />
|
||
With directory <code>file-prefix</code>: for command, file, directory and
|
||
globbing completion (options <code>-c</code>, <code>-f</code>, <code>-/</code>, <code>-g</code>), the file
|
||
prefix is implicitly added in front of the completion. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -/ -W ~/Mail maildirs
|
||
</code></pre>
|
||
</div>
|
||
<p>completes any subdirectories to any depth beneath the directory
|
||
<code>~/Mail</code>, although that prefix does not appear on the command line.
|
||
The <code>file-prefix</code> may also be of the form accepted by the <code>-k</code> flag,
|
||
i.e. the name of an array or a literal list in parenthesis. In this
|
||
case all the directories in the list will be searched for possible
|
||
completions.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-q</code><br />
|
||
If used with a suffix as specified by the <code>-S</code> option, this causes
|
||
the suffix to be removed if the next character typed is a blank or
|
||
does not insert anything or if the suffix consists of only one
|
||
character and the next character typed is the same character; this
|
||
the same rule used for the <code>AUTO_REMOVE_SLASH</code> option. The option is
|
||
most useful for list separators (comma, colon, etc.).</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-l</code> <code>cmd</code><br />
|
||
This option restricts the range of command line words that are
|
||
considered to be arguments. If combined with one of the extended
|
||
completion patterns ‘<code>p[</code>...<code>]</code>’, ‘<code>r[</code>...<code>]</code>’, or ‘<code>R[</code>...<code>]</code>’ (see
|
||
<a href="#Extended-Completion">Extended Completion</a> below) the range is
|
||
restricted to the range of arguments specified in the brackets.
|
||
Completion is then performed as if these had been given as arguments
|
||
to the <code>cmd</code> supplied with the option. If the <code>cmd</code> string is empty
|
||
the first word in the range is instead taken as the command name,
|
||
and command name completion performed on the first word in the
|
||
range. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -x 'r[-exec,;]' -l '' -- find
|
||
</code></pre>
|
||
</div>
|
||
<p>completes arguments between ‘<code>-exec</code>’ and the following ‘<code>;</code>’ (or
|
||
the end of the command line if there is no such string) as if they
|
||
were a separate command line.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-h</code> <code>cmd</code><br />
|
||
Normally zsh completes quoted strings as a whole. With this option,
|
||
completion can be done separately on different parts of such
|
||
strings. It works like the <code>-l</code> option but makes the completion code
|
||
work on the parts of the current word that are separated by spaces.
|
||
These parts are completed as if they were arguments to the given
|
||
<code>cmd</code>. If <code>cmd</code> is the empty string, the first part is completed as
|
||
a command name, as with <code>-l</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-U</code><br />
|
||
Use the whole list of possible completions, whether or not they
|
||
actually match the word on the command line. The word typed so far
|
||
will be deleted. This is most useful with a function (given by the
|
||
<code>-K</code> option) which can examine the word components passed to it (or
|
||
via the <code>read</code> builtin’s <code>-c</code> and <code>-l</code> flags) and use its own
|
||
criteria to decide what matches. If there is no completion, the
|
||
original word is retained. Since the produced possible completions
|
||
seldom have interesting common prefixes and suffixes, menu
|
||
completion is started immediately if <code>AUTO_MENU</code> is set and this
|
||
flag is used.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-y</code> <code>func-or-var</code><br />
|
||
<span id="index-reply_002c-use-of-3"></span></p>
|
||
<p>The list provided by <code>func-or-var</code> is displayed instead of the list
|
||
of completions whenever a listing is required; the actual
|
||
completions to be inserted are not affected. It can be provided in
|
||
two ways. Firstly, if <code>func-or-var</code> begins with a <code>$</code> it defines a
|
||
variable, or if it begins with a left parenthesis a literal array,
|
||
which contains the list. A variable may have been set by a call to a
|
||
function using the <code>-K</code> option. Otherwise it contains the name of a
|
||
function which will be executed to create the list. The function
|
||
will be passed as an argument list all matching completions,
|
||
including prefixes and suffixes expanded in full, and should set the
|
||
array <code>reply</code> to the result. In both cases, the display list will
|
||
only be retrieved after a complete list of matches has been created.</p>
|
||
<p>Note that the returned list does not have to correspond, even in
|
||
length, to the original set of matches, and may be passed as a
|
||
scalar instead of an array. No special formatting of characters is
|
||
performed on the output in this case; in particular, newlines are
|
||
printed literally and if they appear output in columns is
|
||
suppressed.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-X</code> <code>explanation</code><br />
|
||
Print <code>explanation</code> when trying completion on the current set of
|
||
options. A ‘<code>%n</code>’ in this string is replaced by the number of
|
||
matches that were added for this explanation string. The explanation
|
||
only appears if completion was tried and there was no unique match,
|
||
or when listing completions. Explanation strings will be listed
|
||
together with the matches of the group specified together with the
|
||
<code>-X</code> option (using the <code>-J</code> or <code>-V</code> option). If the same explanation
|
||
string is given to multiple <code>-X</code> options, the string appears only
|
||
once (for each group) and the number of matches shown for the ‘<code>%n</code>’
|
||
is the total number of all matches for each of these uses. In any
|
||
case, the explanation string will only be shown if there was at
|
||
least one match added for the explanation string.</p>
|
||
<p>The sequences <code>%B</code>, <code>%b</code>, <code>%S</code>, <code>%s</code>, <code>%U</code>, and <code>%u</code> specify output
|
||
attributes (bold, standout, and underline), <code>%F</code>, <code>%f</code>, <code>%K</code>, <code>%k</code>
|
||
specify foreground and background colours, and <code>%{``...``%}</code> can be
|
||
used to include literal escape sequences as in prompts.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-Y</code> <code>explanation</code><br />
|
||
Identical to <code>-X</code>, except that the <code>explanation</code> first undergoes
|
||
expansion following the usual rules for strings in double quotes.
|
||
The expansion will be carried out after any functions are called for
|
||
the <code>-K</code> or <code>-y</code> options, allowing them to set variables.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-t</code> <code>continue</code><br />
|
||
The <code>continue</code>-string contains a character that specifies which set
|
||
of completion flags should be used next. It is useful:</p>
|
||
<p>(i) With <code>-T</code>, or when trying a list of pattern completions, when
|
||
<code>compctl</code> would usually continue with ordinary processing after
|
||
finding matches; this can be suppressed with ‘<code>-tn</code>’.</p>
|
||
<p>(ii) With a list of alternatives separated by <code>+</code>, when <code>compctl</code>
|
||
would normally stop when one of the alternatives generates matches.
|
||
It can be forced to consider the next set of completions by adding
|
||
‘<code>-t+</code>’ to the flags of the alternative before the ‘<code>+</code>’.</p>
|
||
<p>(iii) In an extended completion list (see below), when <code>compctl</code>
|
||
would normally continue until a set of conditions succeeded, then
|
||
use only the immediately following flags. With ‘<code>-t-</code>’, <code>compctl</code>
|
||
will continue trying extended completions after the next ‘<code>-</code>’; with
|
||
‘<code>-tx</code>’ it will attempt completion with the default flags, in other
|
||
words those before the ‘<code>-x</code>’.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-J</code> <code>name</code><br />
|
||
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 <code>default</code>. 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.</p>
|
||
<p>This can be useful with non-exclusive alternative completions. For
|
||
example, in</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -f -J files -t+ + -v -J variables foo
|
||
</code></pre>
|
||
</div>
|
||
<p>both files and variables are possible completions, as the <code>-t+</code>
|
||
forces both sets of alternatives before and after the <code>+</code> to be
|
||
considered at once. Because of the <code>-J</code> options, however, all files
|
||
are listed before all variables.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-V</code> <code>name</code><br />
|
||
Like <code>-J</code>, but matches within the group will not be sorted in
|
||
listings nor in menu completion. These unsorted groups are in a
|
||
different name space from the sorted ones, so groups defined as <code>-J files</code> and <code>-V files</code> are distinct.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-1</code><br />
|
||
If given together with the <code>-V</code> option, makes only consecutive
|
||
duplicates in the group be removed. Note that groups with and
|
||
without this flag are in different name spaces.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-2</code><br />
|
||
If given together with the <code>-J</code> or <code>-V</code> option, makes all duplicates
|
||
be kept. Again, groups with and without this flag are in different
|
||
name spaces.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>-M</code> <code>match-spec</code><br />
|
||
This defines additional matching control specifications that should
|
||
be used only when testing words for the list of flags this flag
|
||
appears in. The format of the <code>match-spec</code> string is described in
|
||
<a href="Completion-Widgets.html#Completion-Matching-Control">Completion Matching
|
||
Control</a>.</p>
|
||
</li>
|
||
</ul>
|
||
<hr />
|
||
<p><span id="Alternative-Completion"></span>
|
||
<span id="Alternative-Completion-1"></span></p>
|
||
<h2 id="215-alternative-completion"><a class="header" href="#215-alternative-completion">21.5 Alternative Completion</a></h2>
|
||
<p><code>compctl</code> [ <code>-CDT</code> ] <code>options</code> <code>+</code> <code>options</code> [ <code>+</code> ... ] [ <code>+</code> ]
|
||
<code>command</code> ...</p>
|
||
<p>The form with ‘<code>+</code>’ specifies alternative options. Completion is tried
|
||
with the options before the first ‘<code>+</code>’. If this produces no matches
|
||
completion is tried with the flags after the ‘<code>+</code>’ and so on. If there
|
||
are no flags after the last ‘<code>+</code>’ and a match has not been found up to
|
||
that point, default completion is tried. If the list of flags contains a
|
||
<code>-t</code> with a <code>+</code> character, the next list of flags is used even if the
|
||
current list produced matches.</p>
|
||
<hr />
|
||
<p><span id="Extended-Completion"></span></p>
|
||
<p>Additional options are available that restrict completion to some part
|
||
of the command line; this is referred to as ‘extended completion’.</p>
|
||
<p><span id="Extended-Completion-1"></span></p>
|
||
<h2 id="216-extended-completion"><a class="header" href="#216-extended-completion">21.6 Extended Completion</a></h2>
|
||
<p><code>compctl </code>[ <code>-CDT</code> ] <code>options</code> <code>-x</code> <code>pattern</code> <code>options</code> <code>-</code> ...
|
||
<code>-``-</code></p>
|
||
<p><code> </code>[ <code>command</code> ... ]</p>
|
||
<p><code>compctl </code>[ <code>-CDT</code> ] <code>options</code> [ <code>-x</code> <code>pattern</code> <code>options</code> <code>-</code> ...
|
||
<code>-``-</code> ]</p>
|
||
<p><code> </code>[ <code>+</code> <code>options</code> [ <code>-x</code> ... <code>-``-</code> ] ... [<code>+</code>] ] [
|
||
<code>command</code> ... ]</p>
|
||
<p>The form with ‘<code>-x</code>’ specifies extended completion for the commands
|
||
given; as shown, it may be combined with alternative completion using
|
||
‘<code>+</code>’. Each <code>pattern</code> is examined in turn; when a match is found, the
|
||
corresponding <code>options</code>, as described in <a href="#Option-Flags">Option Flags</a>
|
||
above, are used to generate possible completions. If no <code>pattern</code>
|
||
matches, the <code>options</code> given before the <code>-x</code> are used.</p>
|
||
<p>Note that each pattern should be supplied as a single argument and
|
||
should be quoted to prevent expansion of metacharacters by the shell.</p>
|
||
<p>A <code>pattern</code> is built of sub-patterns separated by commas; it matches if
|
||
at least one of these sub-patterns matches (they are ‘or’ed). These
|
||
sub-patterns are in turn composed of other sub-patterns separated by
|
||
white spaces which match if all of the sub-patterns match (they are
|
||
‘and’ed). An element of the sub-patterns is of the form
|
||
‘<code>c``[</code>...<code>][</code>...<code>]</code>’, where the pairs of brackets may be repeated as
|
||
often as necessary, and matches if any of the sets of brackets match (an
|
||
‘or’). The example below makes this clearer.</p>
|
||
<p>The elements may be any of the following:</p>
|
||
<ul>
|
||
<li>
|
||
<p><code>s[``string``]</code>...<br />
|
||
Matches if the current word on the command line starts with one of
|
||
the strings given in brackets. The <code>string</code> is not removed and is
|
||
not part of the completion.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>S[``string``]</code>...<br />
|
||
Like <code>s[``string``]</code> except that the <code>string</code> is part of the
|
||
completion.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>p[``from``,``to``]</code>...<br />
|
||
Matches if the number of the current word is between one of the
|
||
<code>from</code> and <code>to</code> pairs inclusive. The comma and <code>to</code> are optional;
|
||
<code>to</code> defaults to the same value as <code>from</code>. The numbers may be
|
||
negative: <code>-``n</code> refers to the <code>n</code>’th last word on the line.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>c[``offset``,``string``]</code>...<br />
|
||
Matches if the <code>string</code> matches the word offset by <code>offset</code> from the
|
||
current word position. Usually <code>offset</code> will be negative.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>C[``offset``,``pattern``]</code>...<br />
|
||
Like <code>c</code> but using pattern matching instead.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>w[``index``,``string``]</code>...<br />
|
||
Matches if the word in position <code>index</code> is equal to the
|
||
corresponding <code>string</code>. Note that the word count is made after any
|
||
alias expansion.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>W[``index``,``pattern``]</code>...<br />
|
||
Like <code>w</code> but using pattern matching instead.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>n[``index``,``string``]</code>...<br />
|
||
Matches if the current word contains <code>string</code>. Anything up to and
|
||
including the <code>index</code>th occurrence of this string will not be
|
||
considered part of the completion, but the rest will. <code>index</code> may be
|
||
negative to count from the end: in most cases, <code>index</code> will be 1 or
|
||
-1. For example,</p>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -s '`users`' -x 'n[1,@]' -k hosts -- talk
|
||
</code></pre>
|
||
</div>
|
||
<p>will usually complete usernames, but if you insert an <code>@</code> after the
|
||
name, names from the array <code>hosts</code> (assumed to contain hostnames,
|
||
though you must make the array yourself) will be completed. Other
|
||
commands such as <code>rcp</code> can be handled similarly.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>N[``index``,``string``]</code>...<br />
|
||
Like <code>n</code> except that the string will be taken as a character class.
|
||
Anything up to and including the <code>index</code>th occurrence of any of the
|
||
characters in <code>string</code> will not be considered part of the
|
||
completion.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>m[``min``,``max``]</code>...<br />
|
||
Matches if the total number of words lies between <code>min</code> and <code>max</code>
|
||
inclusive.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>r[``str1``,``str2``]</code>...<br />
|
||
Matches if the cursor is after a word with prefix <code>str1</code>. If there
|
||
is also a word with prefix <code>str2</code> on the command line after the one
|
||
matched by <code>str1</code> it matches only if the cursor is before this word.
|
||
If the comma and <code>str2</code> are omitted, it matches if the cursor is
|
||
after a word with prefix <code>str1</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>R[``str1``,``str2``]</code>...<br />
|
||
Like <code>r</code> but using pattern matching instead.</p>
|
||
</li>
|
||
<li>
|
||
<p><code>q[``str``]</code>...<br />
|
||
Matches the word currently being completed is in single quotes and
|
||
the <code>str</code> begins with the letter ‘s’, or if completion is done in
|
||
double quotes and <code>str</code> starts with the letter ‘d’, or if completion
|
||
is done in backticks and <code>str</code> starts with a ‘b’.</p>
|
||
</li>
|
||
</ul>
|
||
<hr />
|
||
<p><span id="Example"></span> <span id="Example-3"></span></p>
|
||
<h2 id="217-example"><a class="header" href="#217-example">21.7 Example</a></h2>
|
||
<div class="example">
|
||
<pre><code class="language-example">compctl -u -x 's[+] c[-1,-f],s[-f+]' \
|
||
-g '~/Mail/*(:t)' - 's[-f],c[-1,-f]' -f -- mail
|
||
</code></pre>
|
||
</div>
|
||
<p>This is to be interpreted as follows:</p>
|
||
<p>If the current command is <code>mail</code>, then</p>
|
||
<blockquote>
|
||
<p>if ((the current word begins with <code>+</code> and the previous word is <code>-f</code>)
|
||
or (the current word begins with <code>-f+</code>)), then complete the
|
||
non-directory part (the ‘<code>:t</code>’ glob modifier) of files in the
|
||
directory <code>~/Mail</code>; else</p>
|
||
<p>if the current word begins with <code>-f</code> or the previous word was <code>-f</code>,
|
||
then complete any file; else</p>
|
||
<p>complete user names.</p>
|
||
</blockquote>
|
||
<hr />
|
||
<p>This document was generated on <em>February 15, 2020</em> using
|
||
<a href="http://www.nongnu.org/texi2html/"><em>texi2html 5.0</em></a>.<br />
|
||
Zsh version 5.8, released on February 14, 2020.</p>
|
||
|
||
</main>
|
||
|
||
<nav class="nav-wrapper" aria-label="Page navigation">
|
||
<!-- Mobile navigation buttons -->
|
||
|
||
<a rel="prev" href="Completion-System.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<i class="fa fa-angle-left"></i>
|
||
</a>
|
||
|
||
|
||
|
||
<a rel="next" href="Zsh-Modules.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<i class="fa fa-angle-right"></i>
|
||
</a>
|
||
|
||
|
||
<div style="clear: both"></div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
||
|
||
<a rel="prev" href="Completion-System.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<i class="fa fa-angle-left"></i>
|
||
</a>
|
||
|
||
|
||
|
||
<a rel="next" href="Zsh-Modules.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<i class="fa fa-angle-right"></i>
|
||
</a>
|
||
|
||
</nav>
|
||
|
||
</div>
|
||
|
||
|
||
<!-- Livereload script (if served using the cli tool) -->
|
||
<script type="text/javascript">
|
||
var socket = new WebSocket("ws://localhost:3000/__livereload");
|
||
socket.onmessage = function (event) {
|
||
if (event.data === "reload") {
|
||
socket.close();
|
||
location.reload();
|
||
}
|
||
};
|
||
|
||
window.onbeforeunload = function() {
|
||
socket.close();
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
window.playground_copyable = true;
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
<script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="searcher.js" type="text/javascript" charset="utf-8"></script>
|
||
|
||
|
||
<script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="highlight.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="book.js" type="text/javascript" charset="utf-8"></script>
|
||
|
||
<!-- Custom JS scripts -->
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html>
|