File: bind.html

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (584 lines) | stat: -rw-r--r-- 53,379 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>bind - handle fish key bindings &#8212; fish-shell 4.2.1 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=4da8bbd6" />
    <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=f89b4716" />
    <script src="../_static/documentation_options.js?v=6fb65176"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="block - temporarily block delivery of events" href="block.html" />
    <link rel="prev" title="bg - send jobs to background" href="bg.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/fish.png" />
     

  </head><body><div id="fmain">  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="../_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="../index.html">fish-shell 4.2.1 documentation</a> &#187;
    

          <li class="nav-item nav-item-1"><a href="../commands.html" accesskey="U">Commands</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">bind - handle fish key bindings</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../../current/">See the latest release.</a>
    </div>

      </ul>
    </div>    

    <div class="document">
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
<div>
<h3><a href="../index.html">Documents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently asked questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../interactive.html">Interactive use</a></li>
<li class="toctree-l1"><a class="reference internal" href="../language.html">The fish language</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fish_for_bash_users.html">Fish for bash users</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../completions.html">Writing your own completions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../prompt.html">Writing your own prompt</a></li>
<li class="toctree-l1"><a class="reference internal" href="../design.html">Design</a></li>
<li class="toctree-l1"><a class="reference internal" href="../relnotes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../terminal-compatibility.html">Terminal Compatibility</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing To Fish</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>

</div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<div>
<h4><a href="../index.html">Sections</a></h4>
<ul>
<li><a class="reference internal" href="#">bind - handle fish key bindings</a><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#description">Description</a></li>
<li><a class="reference internal" href="#options">Options</a></li>
<li><a class="reference internal" href="#special-input-functions">Special input functions</a></li>
<li><a class="reference internal" href="#additional-functions">Additional functions</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#terminal-limitations">Terminal Limitations</a></li>
<li><a class="reference internal" href="#key-timeout">Key timeout</a></li>
</ul>
</li>
</ul>

</div>
        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="bind-handle-fish-key-bindings">
<h1>bind - handle fish key bindings<a class="headerlink" href="#bind-handle-fish-key-bindings" title="Link to this heading">¶</a></h1>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
<div class="highlight-fish-synopsis notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="g g-Other">[(</span><span class="no">-M</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--mode</span><span class="g g-Other">)</span><span class="w"> </span><span class="no">MODE</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[(</span><span class="no">-m</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--sets-mode</span><span class="g g-Other">)</span><span class="w"> </span><span class="no">NEW_MODE</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--preset</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--user</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">-s</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--silent</span><span class="g g-Other">]</span><span class="w"> </span><span class="no">KEYS</span><span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="g g-Other">...</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">[(</span><span class="no">-M</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--mode</span><span class="g g-Other">)</span><span class="w"> </span><span class="no">MODE</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--preset</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--user</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">KEYS</span><span class="g g-Other">]</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">-a</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--all</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--preset</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--user</span><span class="g g-Other">]</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">(</span><span class="no">-f</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--function-names</span><span class="g g-Other">)</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">(</span><span class="no">-K</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--key-names</span><span class="g g-Other">)</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">(</span><span class="no">-L</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--list-modes</span><span class="g g-Other">)</span>
<span class="nf">bind</span><span class="w"> </span><span class="g g-Other">(</span><span class="no">-e</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--erase</span><span class="g g-Other">)</span><span class="w"> </span><span class="g g-Other">[(</span><span class="no">-M</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--mode</span><span class="g g-Other">)</span><span class="w"> </span><span class="no">MODE</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--preset</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">--user</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">[</span><span class="no">-a</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">--all</span><span class="g g-Other">]</span><span class="w"> </span><span class="g g-Other">|</span><span class="w"> </span><span class="no">KEYS</span><span class="w"> </span><span class="g g-Other">...</span>
</pre></div>
</div>
</section>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Link to this heading">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">bind</span></code> manages key bindings.</p>
<p>If both <code class="docutils literal notranslate"><span class="pre">KEYS</span></code> and <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> are given, <code class="docutils literal notranslate"><span class="pre">bind</span></code> adds (or replaces) a binding in <code class="docutils literal notranslate"><span class="pre">MODE</span></code>.
If only <code class="docutils literal notranslate"><span class="pre">KEYS</span></code> is given, any existing binding for those keys in the given <code class="docutils literal notranslate"><span class="pre">MODE</span></code> will be printed.
If no <code class="docutils literal notranslate"><span class="pre">KEYS</span></code> argument is provided, all bindings (in the given <code class="docutils literal notranslate"><span class="pre">MODE</span></code>) are printed.</p>
<p><code class="docutils literal notranslate"><span class="pre">KEYS</span></code> is a comma-separated list of key names.
Modifier keys can be specified by prefixing a key name with a combination of <code class="docutils literal notranslate"><span class="pre">ctrl-</span></code>, <code class="docutils literal notranslate"><span class="pre">alt-</span></code>, <code class="docutils literal notranslate"><span class="pre">shift-</span></code> and <code class="docutils literal notranslate"><span class="pre">super-</span></code> (i.e. the “windows” or “command” key).
For example, pressing <kbd class="kbd docutils literal notranslate">w</kbd> while holding the Alt modifier is written as <code class="docutils literal notranslate"><span class="pre">alt-w</span></code>.
Key names are case-sensitive; for example <code class="docutils literal notranslate"><span class="pre">alt-W</span></code> is the same as <code class="docutils literal notranslate"><span class="pre">alt-shift-w</span></code>.
<code class="docutils literal notranslate"><span class="pre">ctrl-x,ctrl-e</span></code> would mean pressing <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">x</kbd> followed by <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">e</kbd>.</p>
<p>Some keys have names, usually because they don’t have an obvious printable character representation.
They are:</p>
<ul class="simple">
<li><p>the arrow keys <code class="docutils literal notranslate"><span class="pre">up</span></code>, <code class="docutils literal notranslate"><span class="pre">down</span></code>, <code class="docutils literal notranslate"><span class="pre">left</span></code> and <code class="docutils literal notranslate"><span class="pre">right</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">backspace</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">comma</span></code> (<code class="docutils literal notranslate"><span class="pre">,</span></code>),</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">delete</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">end</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">enter</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">escape</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">f1</span></code> through <code class="docutils literal notranslate"><span class="pre">f12</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">home</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">insert</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">menu</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">minus</span></code> (<code class="docutils literal notranslate"><span class="pre">-</span></code>),</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pageup</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">pagedown</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">printscreen</span></code>,</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">space</span></code> and</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">tab</span></code>,</p></li>
</ul>
<p>These names are case-sensitive.</p>
<p>An empty value (<code class="docutils literal notranslate"><span class="pre">''</span></code>) for <code class="docutils literal notranslate"><span class="pre">KEYS</span></code> designates the generic binding that will be used if nothing else matches. For most bind modes, it makes sense to bind this to the <code class="docutils literal notranslate"><span class="pre">self-insert</span></code> function (i.e. <code class="docutils literal notranslate"><span class="pre">bind</span> <span class="pre">''</span> <span class="pre">self-insert</span></code>). This will insert any keystrokes that have no bindings otherwise. Non-printable characters are ignored by the editor, so this will not result in control sequences being inserted.</p>
<p>To find the name of a key combination you can use <a class="reference internal" href="fish_key_reader.html"><span class="doc">fish_key_reader</span></a>.</p>
<p><code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> can be any fish command, but it can also be one of a set of special input functions. These include functions for moving the cursor, operating on the kill-ring, performing tab completion, etc. Use <code class="docutils literal notranslate"><span class="pre">bind</span> <span class="pre">--function-names</span></code> or <a class="reference internal" href="#special-input-functions"><span class="std std-ref">see below</span></a> for a list of these input functions.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If a script changes the commandline, it should finish by calling the <code class="docutils literal notranslate"><span class="pre">repaint</span></code> special input function.</p>
</div>
<p>Key bindings may use “modes”, which mimics vi’s modal input behavior. The default mode is “default” (in vi-mode, that’s vi’s “normal” mode). Every key binding applies to a single mode; you can specify which one with <code class="docutils literal notranslate"><span class="pre">-M</span> <span class="pre">MODE</span></code>. If the key binding should change the mode, you can specify the new mode with <code class="docutils literal notranslate"><span class="pre">-m</span> <span class="pre">NEW_MODE</span></code>. The mode can be viewed and changed via the <code class="docutils literal notranslate"><span class="pre">$fish_bind_mode</span></code> variable. If you want to change the mode from inside a fish function, use <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">fish_bind_mode</span> <span class="pre">MODE</span></code>.</p>
<p>To save custom key bindings, put the <code class="docutils literal notranslate"><span class="pre">bind</span></code> statements into <a class="reference internal" href="../language.html#configuration"><span class="std std-ref">config.fish</span></a>. Alternatively, fish also automatically executes a function called <code class="docutils literal notranslate"><span class="pre">fish_user_key_bindings</span></code> if it exists.</p>
</section>
<section id="options">
<h2>Options<a class="headerlink" href="#options" title="Link to this heading">¶</a></h2>
<p>The following options are available:</p>
<dl class="simple">
<dt><strong>-f</strong> or <strong>--function-names</strong></dt><dd><p>Display a list of available input functions</p>
</dd>
<dt><strong>-K</strong> or <strong>--key-names</strong></dt><dd><p>Display a list of available named keys such as <code class="docutils literal notranslate"><span class="pre">backspace</span></code>.</p>
</dd>
<dt><strong>-L</strong> or <strong>--list-modes</strong></dt><dd><p>Display a list of defined bind modes</p>
</dd>
<dt><strong>-M MODE</strong> or <strong>--mode</strong> <em>MODE</em></dt><dd><p>Specify a bind mode that the bind is used in. Defaults to “default”.
If you use <a class="reference internal" href="../interactive.html#vi-mode"><span class="std std-ref">vi bindings</span></a>, that’s the <em>command</em> mode,
what vi calls “normal” mode.</p>
</dd>
<dt><strong>-m NEW_MODE</strong> or <strong>--sets-mode</strong> <em>NEW_MODE</em></dt><dd><p>Change the current mode to <em>NEW_MODE</em> after this binding is executed</p>
</dd>
<dt><strong>-e</strong> or <strong>--erase</strong></dt><dd><p>Erase the binding with the given sequence and mode instead of defining a new one.
Multiple sequences can be specified with this flag.
Specifying <strong>-a</strong> or <strong>--all</strong> with <strong>-M</strong> or <strong>--mode</strong> erases all binds in the given mode regardless of sequence.
Specifying <strong>-a</strong> or <strong>--all</strong> without <strong>-M</strong> or <strong>--mode</strong> erases all binds in all modes regardless of sequence.</p>
</dd>
<dt><strong>-a</strong> or <strong>--all</strong></dt><dd><p>See <strong>--erase</strong></p>
</dd>
<dt><strong>--preset</strong> and <strong>--user</strong></dt><dd><p>Specify if bind should operate on user or preset bindings.
User bindings take precedence over preset bindings when fish looks up mappings.
By default, all <code class="docutils literal notranslate"><span class="pre">bind</span></code> invocations work on the “user” level except for listing, which will show both levels.
All invocations except for inserting new bindings can operate on both levels at the same time (if both <strong>--preset</strong> and <strong>--user</strong> are given).
<strong>--preset</strong> should only be used in full binding sets (like when working on <code class="docutils literal notranslate"><span class="pre">fish_vi_key_bindings</span></code>).</p>
</dd>
<dt><strong>-s</strong> or <strong>--silent</strong></dt><dd><p>Silences some of the error messages, including for unknown key names and unbound sequences.</p>
</dd>
<dt><strong>-h</strong> or <strong>--help</strong></dt><dd><p>Displays help about using this command.</p>
</dd>
</dl>
</section>
<section id="special-input-functions">
<span id="id1"></span><h2>Special input functions<a class="headerlink" href="#special-input-functions" title="Link to this heading">¶</a></h2>
<p>The following special input functions are available:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">and</span></code></dt><dd><p>only execute the next function if the previous succeeded (note: only some functions report success)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">accept-autosuggestion</span></code></dt><dd><p>accept the current autosuggestion. Returns false when there was nothing to accept.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-char</span></code></dt><dd><p>move one character to the left.
If the completion pager is active, select the previous completion instead.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-char-passive</span></code></dt><dd><p>move one character to the left, but do not trigger any non-movement-related operations. If the cursor is at the start of
the commandline, does nothing. Does not change the selected item in the completion pager UI when shown.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-bigword</span></code></dt><dd><p>move one whitespace-delimited word to the left</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-token</span></code></dt><dd><p>move one argument to the left</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-delete-char</span></code></dt><dd><p>deletes one character of input to the left of the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-kill-bigword</span></code></dt><dd><p>move the whitespace-delimited word to the left of the cursor to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-kill-token</span></code></dt><dd><p>move the argument to the left of the cursor to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-kill-line</span></code></dt><dd><p>move everything from the beginning of the line to the cursor to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-kill-path-component</span></code></dt><dd><p>move one path component to the left of the cursor to the killring. A path component is everything likely to belong to a path component, i.e. not any of the following: <cite>/={,}’&quot;:&#64; |;&lt;&gt;&amp;</cite>, plus newlines and tabs.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-kill-word</span></code></dt><dd><p>move the word to the left of the cursor to the killring. The “word” here is everything up to punctuation or whitespace.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">backward-word</span></code></dt><dd><p>move one word to the left</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">beginning-of-buffer</span></code></dt><dd><p>moves to the beginning of the buffer, i.e. the start of the first line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">beginning-of-history</span></code></dt><dd><p>move to the beginning of the history</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">beginning-of-line</span></code></dt><dd><p>move to the beginning of the line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">begin-selection</span></code></dt><dd><p>start selecting text</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cancel</span></code></dt><dd><p>close the pager if it is open, or undo the most recent completion if one was just inserted</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">cancel-commandline</span></code></dt><dd><p>cancel the current commandline and replace it with a new empty one, leaving the old one in place with a marker to show that it was cancelled</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">capitalize-word</span></code></dt><dd><p>make the current word begin with a capital letter</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">clear-commandline</span></code></dt><dd><p>empty the entire commandline</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">clear-screen</span></code></dt><dd><p>clears the screen and redraws the prompt.</p>
</dd>
</dl>
<dl class="simple" id="special-input-functions-scrollback-push">
<dt><code class="docutils literal notranslate"><span class="pre">scrollback-push</span></code></dt><dd><p>pushes earlier output to the terminal scrollback, positioning the prompt at the top.
This requires the terminal to implement the ECMA-48 <a class="reference internal" href="../terminal-compatibility.html#term-compat-indn"><span class="std std-ref">SCROLL UP</span></a> command and <a class="reference internal" href="../terminal-compatibility.html#term-compat-cursor-position-report"><span class="std std-ref">cursor position reporting</span></a>.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">complete</span></code></dt><dd><p>guess the remainder of the current token</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">complete-and-search</span></code></dt><dd><p>invoke the searchable pager on completion options (for convenience, this also moves backwards in the completion pager)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">delete-char</span></code></dt><dd><p>delete one character to the right of the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">delete-or-exit</span></code></dt><dd><p>delete one character to the right of the cursor, or exit the shell if the commandline is empty</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">down-line</span></code></dt><dd><p>move down one line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">downcase-word</span></code></dt><dd><p>make the current word lowercase</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">end-of-buffer</span></code></dt><dd><p>moves to the end of the buffer, i.e. the end of the first line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">end-of-history</span></code></dt><dd><p>move to the end of the history</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">end-of-line</span></code></dt><dd><p>move to the end of the line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">end-selection</span></code></dt><dd><p>end selecting text</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">expand-abbr</span></code></dt><dd><p>expands any abbreviation currently under the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">execute</span></code></dt><dd><p>run the current commandline</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">exit</span></code></dt><dd><p>exit the shell</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-bigword</span></code></dt><dd><p>move one whitespace-delimited word to the right</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-token</span></code></dt><dd><p>move one argument to the right</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-char</span></code></dt><dd><p>move one character to the right; or if at the end of the commandline, accept the current autosuggestion.
If the completion pager is active, select the next completion instead.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-char-passive</span></code></dt><dd><p>move one character to the right, but do not trigger any non-movement-related operations. If the cursor is at the end of the
commandline, does not accept the current autosuggestion (if any). Does not change the selected item in the completion pager,
if shown.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-single-char</span></code></dt><dd><p>move one character to the right; or if at the end of the commandline, accept a single char from the current autosuggestion.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-word</span></code></dt><dd><p>move one word to the right; or if at the end of the commandline, accept one word
from the current autosuggestion.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-pager</span></code></dt><dd><p>invoke the searchable pager on history (incremental search); or if the history pager is already active, search further backwards in time.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-delete</span></code></dt><dd><p>permanently delete the current history item, either from the history pager or from an active up-arrow history search</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-search-backward</span></code></dt><dd><p>search the history for the previous match</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-search-forward</span></code></dt><dd><p>search the history for the next match</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-prefix-search-backward</span></code></dt><dd><p>search the history for the previous prefix match</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-prefix-search-forward</span></code></dt><dd><p>search the history for the next prefix match</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-token-search-backward</span></code></dt><dd><p>search the history for the previous matching argument</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-token-search-forward</span></code></dt><dd><p>search the history for the next matching argument</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-last-token-search-backward</span></code></dt><dd><p>search the history for the previous matching last argument</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">history-last-token-search-forward</span></code></dt><dd><p>search the history for the next matching last argument</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-jump</span></code> and <code class="docutils literal notranslate"><span class="pre">backward-jump</span></code></dt><dd><p>read another character and jump to its next occurrence after/before the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">forward-jump-till</span></code> and <code class="docutils literal notranslate"><span class="pre">backward-jump-till</span></code></dt><dd><p>jump to right <em>before</em> the next occurrence</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">repeat-jump</span></code> and <code class="docutils literal notranslate"><span class="pre">repeat-jump-reverse</span></code></dt><dd><p>redo the last jump in the same/opposite direction</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">jump-to-matching-bracket</span></code></dt><dd><p>jump to matching bracket if the character under the cursor is bracket;
otherwise, jump to the next occurrence of <em>any right</em> bracket after the cursor.
The following brackets are considered: <code class="docutils literal notranslate"><span class="pre">([{}])</span></code></p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">jump-till-matching-bracket</span></code></dt><dd><p>the same as <code class="docutils literal notranslate"><span class="pre">jump-to-matching-bracket</span></code> but offset cursor to the right for left bracket, and offset cursor to the left for right bracket.
The offset is applied for both the position we jump from and position we jump to.
In other words, the cursor will continuously jump inside the brackets but won’t reach them by 1 character.
The input function is useful to emulate <code class="docutils literal notranslate"><span class="pre">ib</span></code> vi text object.
The following brackets are considered: <code class="docutils literal notranslate"><span class="pre">([{}])</span></code></p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-bigword</span></code></dt><dd><p>move the next whitespace-delimited word to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-token</span></code></dt><dd><p>move the next argument to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-line</span></code></dt><dd><p>move everything from the cursor to the end of the line to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-selection</span></code></dt><dd><p>move the selected text to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-whole-line</span></code></dt><dd><p>move the line (including the following newline) to the killring. If the line is the last line, its preceding newline is also removed</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-inner-line</span></code></dt><dd><p>move the line (without the following newline) to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">kill-word</span></code></dt><dd><p>move the next word to the killring</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">nextd-or-forward-word</span></code></dt><dd><p>if the commandline is empty, then move forward in the directory history, otherwise move one word to the right;
or if at the end of the commandline, accept one word from the current autosuggestion.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">or</span></code></dt><dd><p>only execute the next function if the previous did not succeed (note: only some functions report failure)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">pager-toggle-search</span></code></dt><dd><p>toggles the search field if the completions pager is visible; or if used after <code class="docutils literal notranslate"><span class="pre">history-pager</span></code>, search forwards in time.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">prevd-or-backward-word</span></code></dt><dd><p>if the commandline is empty, then move backward in the directory history, otherwise move one word to the left</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">repaint</span></code></dt><dd><p>reexecutes the prompt functions and redraws the prompt (also <code class="docutils literal notranslate"><span class="pre">force-repaint</span></code> for backwards-compatibility)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">repaint-mode</span></code></dt><dd><p>reexecutes the <a class="reference internal" href="fish_mode_prompt.html"><span class="doc">fish_mode_prompt</span></a> and redraws the prompt. This is useful for vi mode. If no <code class="docutils literal notranslate"><span class="pre">fish_mode_prompt</span></code> exists or it prints nothing, it acts like a normal repaint.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">self-insert</span></code></dt><dd><p>inserts the matching sequence into the command line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">self-insert-notfirst</span></code></dt><dd><p>inserts the matching sequence into the command line, unless the cursor is at the beginning</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">suppress-autosuggestion</span></code></dt><dd><p>remove the current autosuggestion. Returns true if there was a suggestion to remove.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">swap-selection-start-stop</span></code></dt><dd><p>go to the other end of the highlighted text without changing the selection</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">transpose-chars</span></code></dt><dd><p>transpose two characters to the left of the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">transpose-words</span></code></dt><dd><p>transpose two words to the left of the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">togglecase-char</span></code></dt><dd><p>toggle the capitalisation (case) of the character under the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">togglecase-selection</span></code></dt><dd><p>toggle the capitalisation (case) of the selection</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">insert-line-under</span></code></dt><dd><p>add a new line under the current line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">insert-line-over</span></code></dt><dd><p>add a new line over the current line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">up-line</span></code></dt><dd><p>move up one line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">undo</span></code> and <code class="docutils literal notranslate"><span class="pre">redo</span></code></dt><dd><p>revert or redo the most recent edits on the command line</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">upcase-word</span></code></dt><dd><p>make the current word uppercase</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">yank</span></code></dt><dd><p>insert the latest entry of the killring into the buffer</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">yank-pop</span></code></dt><dd><p>rotate to the previous entry of the killring</p>
</dd>
</dl>
</section>
<section id="additional-functions">
<h2>Additional functions<a class="headerlink" href="#additional-functions" title="Link to this heading">¶</a></h2>
<p>The following functions are included as normal functions, but are particularly useful for input editing:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">up-or-search</span></code> and <code class="docutils literal notranslate"><span class="pre">down-or-search</span></code></dt><dd><p>move the cursor or search the history depending on the cursor position and current mode</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">edit_command_buffer</span></code></dt><dd><p>open the visual editor (controlled by the <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">VISUAL</span></code> or <span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">EDITOR</span></code> environment variables) with the current command-line contents</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fish_clipboard_copy</span></code></dt><dd><p>copy the current selection to the system clipboard</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fish_clipboard_paste</span></code></dt><dd><p>paste the current selection from the system clipboard before the cursor</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fish_commandline_append</span></code></dt><dd><p>append the argument to the command-line. If the command-line already ends with the argument, this removes the suffix instead. Starts with the last command from history if the command-line is empty.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">fish_commandline_prepend</span></code></dt><dd><p>prepend the argument to the command-line. If the command-line already starts with the argument, this removes the prefix instead. Starts with the last command from history if the command-line is empty.</p>
</dd>
</dl>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Link to this heading">¶</a></h2>
<p>Exit the shell when <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd> is pressed:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="no">ctrl-d</span><span class="w"> </span><span class="s1">&#39;exit&#39;</span>
</pre></div>
</div>
<p>Perform a history search when <kbd class="kbd docutils literal notranslate">pageup</kbd> is pressed:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="no">pageup</span><span class="w"> </span><span class="no">history-search-backward</span>
</pre></div>
</div>
<p>Turn on <a class="reference internal" href="../interactive.html#vi-mode"><span class="std std-ref">vi key bindings</span></a> and rebind <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd> to clear the input line:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">set</span><span class="w"> </span><span class="no">-g</span><span class="w"> </span><span class="no">fish_key_bindings</span><span class="w"> </span><span class="no">fish_vi_key_bindings</span>
<span class="nf">bind</span><span class="w"> </span><span class="no">-M</span><span class="w"> </span><span class="no">insert</span><span class="w"> </span><span class="no">ctrl-c</span><span class="w"> </span><span class="no">kill-whole-line</span><span class="w"> </span><span class="no">repaint</span>
</pre></div>
</div>
<p>Launch <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">diff</span></code> and repaint the commandline afterwards when <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">g</kbd> is pressed:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="no">ctrl-g</span><span class="w"> </span><span class="s1">&#39;git diff&#39;</span><span class="w"> </span><span class="no">repaint</span>
</pre></div>
</div>
<p>Swap <kbd class="kbd docutils literal notranslate">tab</kbd> and <kbd class="kbd docutils literal notranslate">shift</kbd>-<kbd class="kbd docutils literal notranslate">tab</kbd>, making tab focus the search field.
But if the search field is already active, keep the behavior (<kbd class="kbd docutils literal notranslate">tab</kbd> cycles forward, <kbd class="kbd docutils literal notranslate">shift</kbd>-<kbd class="kbd docutils literal notranslate">tab</kbd> backward).:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="no">tab</span><span class="w"> </span><span class="s1">&#39;</span>
<span class="s1">    if commandline --search-field &gt;/dev/null</span>
<span class="s1">        commandline -f complete</span>
<span class="s1">    else</span>
<span class="s1">        commandline -f complete-and-search</span>
<span class="s1">    end</span>
<span class="s1">&#39;</span>
<span class="nf">bind</span><span class="w"> </span><span class="no">shift-tab</span><span class="w"> </span><span class="s1">&#39;</span>
<span class="s1">    if commandline --search-field &gt;/dev/null</span>
<span class="s1">        commandline -f complete-and-search</span>
<span class="s1">    else</span>
<span class="s1">        commandline -f complete</span>
<span class="s1">    end</span>
<span class="s1">&#39;</span>
</pre></div>
</div>
</section>
<section id="terminal-limitations">
<span id="cmd-bind-termlimits"></span><h2>Terminal Limitations<a class="headerlink" href="#terminal-limitations" title="Link to this heading">¶</a></h2>
<p>Unix terminals, like the ones fish operates in, are at heart 70s technology. They have some limitations that applications running inside them can’t workaround.</p>
<p>For instance, historically the control key modifies a character by setting the top three bits to 0. This means:</p>
<ul class="simple">
<li><p>Many characters + control are indistinguishable from other keys: <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">i</kbd> <em>is</em> <kbd class="kbd docutils literal notranslate">tab</kbd>, <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">j</kbd> <em>is</em> newline (<code class="docutils literal notranslate"><span class="pre">\n</span></code>).</p></li>
<li><p>Control and shift don’t work simultaneously - <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">X</kbd> is the same as <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">x</kbd>.</p></li>
</ul>
<p>Other keys don’t have a direct encoding, and are sent as escape sequences. For example <kbd class="kbd docutils literal notranslate">right</kbd> (<code class="docutils literal notranslate"><span class="pre">→</span></code>) usually sends <code class="docutils literal notranslate"><span class="pre">\e\[C</span></code>.</p>
<p>Some modern terminals support newer encodings for keys, that allow distinguishing more characters and modifiers, and fish enables as many of these as it can, automatically.</p>
<p>When in doubt, run <a class="reference internal" href="fish_key_reader.html"><span class="doc">fish_key_reader - explore what characters keyboard keys send</span></a>. If that tells you that pressing <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">i</kbd> sends tab, your terminal does not support these better encodings, and so fish is limited to what it sends.</p>
</section>
<section id="key-timeout">
<span id="cmd-bind-escape"></span><h2>Key timeout<a class="headerlink" href="#key-timeout" title="Link to this heading">¶</a></h2>
<p>When you’ve bound a sequence of multiple characters, there is always the possibility that fish has only seen a part of it, and then it needs to disambiguate between the full sequence and part of it.</p>
<p>For example:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">bind</span><span class="w"> </span><span class="no">j,k</span><span class="w"> </span><span class="s1">&#39;commandline -i foo&#39;</span>
<span class="c"># or `bind jk`</span>
</pre></div>
</div>
<p>will bind the sequence <code class="docutils literal notranslate"><span class="pre">jk</span></code> to insert “foo” into the commandline. When you’ve only pressed “j”, fish doesn’t know if it should insert the “j” (because of the default self-insert), or wait for the “k”.</p>
<p>You can enable a timeout for this, by setting the <span class="target" id="index-2"></span><a class="reference internal" href="../language.html#envvar-fish_sequence_key_delay_ms"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">fish_sequence_key_delay_ms</span></code></a> variable to the timeout in milliseconds. If the timeout elapses, fish will no longer wait for the sequence to be completed, and do what it can with the characters it already has.</p>
<p>The escape key is a special case, because it can be used standalone as a real key or as part of a longer escape sequence, like function or arrow keys. Holding alt and something else also typically sends escape, for example holding alt+a will send an escape character and then an “a”. So the escape character has its own timeout configured with <span class="target" id="index-3"></span><a class="reference internal" href="../language.html#envvar-fish_escape_delay_ms"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">fish_escape_delay_ms</span></code></a>.</p>
<p>See also <a class="reference internal" href="../interactive.html#interactive-key-sequences"><span class="std std-ref">Key sequences</span></a>.</p>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div> 
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="../_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="../index.html">fish-shell 4.2.1 documentation</a> &#187;
    

          <li class="nav-item nav-item-1"><a href="../commands.html" >Commands</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">bind - handle fish key bindings</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../../current/">See the latest release.</a>
    </div>

      </ul>
    </div>  
    <div class="footer">
    &copy; Copyright fish-shell developers.
    <br />
    <a href="https://github.com/fish-shell/fish-shell/issues">Found a bug</a>?
    <br />

    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
    </div>
</div>

<script type="text/javascript">
 FISH_DOCS_VERSION = "4.2";

 function copy_to_clipboard(it) {
     // Find the pre tag we're interested in.
     var pre = it.target;
     while (pre.tagName != "PRE") pre = pre.parentNode;
     var txt = "";
     // Cheesy: If we have a prompt,
     // we only copy prompted lines,
     // by splitting and matching and stuff
     if (pre.querySelector('span.gp')) {
         var texts= [];
         for (var line of pre.innerText.split('\n')) {
             if (line.match(/^>_?.*/)) {
                 texts.push(line.replace(/^>_?/, ""));
             }
         }
         txt = texts.join("\n");
     } else {
         // Even cheesier: If we don't have a prompt, we remove the button text from the end.
         var txt = pre.innerText.substring(0, pre.innerText.length - it.target.innerText.length).trim();
     }

     navigator.clipboard.writeText(txt).then(function() {
         // Success - set the text to indicate it,
         // then set it back after 2 seconds.
         var span = pre.querySelector("button span");
         if (span) {
             var oldText = span.innerText;
             span.innerText = "COPIED!";
             setTimeout(function() {
                 span.innerText = oldText;
             }, 2000);
         }
     }, function() {
     });
 }

  (function () {
      // Add copy buttons to all the codeblocks.
      var codeblocks = document.querySelectorAll('div > pre');

      var button = document.createElement('button');
      var span = document.createElement('span');
      span.innerText = "COPY";
      button.appendChild(span);

      for (var i of codeblocks) {
          var newButton = button.cloneNode(true);
          newButton.addEventListener('click', copy_to_clipboard);
          i.appendChild(newButton);
      }
  })();
</script>

  </body>
</html>