github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/user-guide/terminal-keys.md (about)

     1  # Terminal Hotkeys
     2  
     3  > A list of all the terminal hotkeys and their uses
     4  
     5  <h2>Table of Contents</h2>
     6  <div id="toc">
     7  
     8  - [Command Prompt](#command-prompt)
     9    - [Autocomplete](#autocomplete)
    10    - [Fuzzy Find Autocomplete](#fuzzy-find-autocomplete)
    11    - [Autocomplete Preview](#autocomplete-preview)
    12    - [Command Line Preview](#command-line-preview)
    13    - [Search Shell History](#search-shell-history)
    14    - [Line Editing](#line-editing)
    15      - [Navigation](#navigation)
    16      - [General Hotkeys](#general-hotkeys)
    17    - [Vim Keys](#vim-keys)
    18      - [Supported Keys](#supported-keys)
    19    - [Recalling Previous Words](#recalling-previous-words)
    20  - [Job Control](#job-control)
    21  - [Miscellaneous](#miscellaneous)
    22    - [Cancel Prompt](#cancel-prompt)
    23    - [End Of File](#end-of-file)
    24    - [Alternative Cancel Key](#alternative-cancel-key)
    25    - [Clear Screen](#clear-screen)
    26    - [EDITOR](#editor)
    27  
    28  </div>
    29  
    30  
    31  ## Command Prompt
    32  
    33  ### Autocomplete
    34  
    35  Pressing `tab` provides autocompletion suggestions. Suggestions can come in one
    36  of two formats:
    37  
    38  1. a gridded view where the hint text (the, typically blue, text under the
    39     prompt) provides the description
    40  2. a list view where the description is printed alongside the completion
    41     suggestion.
    42  
    43  While the autocompletion suggestions are open, the following keys are assigned
    44  roles:
    45  
    46  * arrow keys (`left`, `right`, `up`, `down`): highlight different suggestions
    47    
    48  * `tab`: highlight the next suggestion
    49    
    50  * `shift`+`tab`: highlight the previous suggestion
    51    
    52  * `enter` / `return`: this selects the highlighted autocompletion
    53    
    54  * `esc`: closes the suggestions without selecting one
    55    
    56  * `ctrl`+`f`: fuzzy find in the suggestions
    57  
    58  * `f1`: show / hide autocomplete preview box. This will hide your terminal
    59    output while enabled. The preview box supports additional key bindings
    60    ([see below](#autocomplete-preview))
    61  
    62  * `f9`: show the command line preview box. This will output the contents of
    63    your command pipeline ([see below](#command-line-preview))
    64  
    65  ### Fuzzy Find Autocomplete
    66  
    67  Pressing `ctrl`+`f` either from the prompt, or while the autocomplete
    68  suggestions are open, will open up the fuzzy find dialog to search through
    69  available suggestions. This can also be used to quickly jump to specific
    70  sub-directories.
    71  
    72  Your typed search terms will appear in the hint text.
    73  
    74  By default the fuzzy finder will look for any item that includes _all_ of the
    75  search words. However the search behavior can be changed if the first search
    76  term is any of the following:
    77  
    78  * `or`: show results that match _any_ of the search terms. eg `or .md .txt`
    79    will match both markdown and txt files (when finding files in completion
    80    suggestions).
    81  
    82  * `!`: only show suggestions that do not match any of the search terms. eg
    83    `! .md .txt` will match all files except markdown and txt files (when finding
    84    files in completion suggestions).
    85  
    86  * `g`: show only results that match a shell glob. eg `*.txt`. This mode is
    87    automatically assumed if you include an abstricts in your search term.
    88  
    89  * `rx`: use a regexp pattern matcher instead of any fuzzy search. Expressions
    90    will be case insensitive and non-greedy by default.
    91  
    92  Aside from globbing matches, searching in fuzzy finder is not case sensitive.
    93  
    94  While the fuzzy finder is open, the following keys are assigned roles:
    95  
    96  * arrow keys (`left`, `right`, `up`, `down`): highlight different suggestions
    97   
    98  * `tab`: highlight the next suggestion
    99    
   100  * `shift`+`tab`: highlight the previous suggestion
   101    
   102  * `enter` / `return`: this selects the highlighted autocompletion
   103    
   104  * `esc`: cancel search
   105  
   106  * `f1`: show / hide preview box. This will hide your terminal output while
   107    enabled. The preview box supports additional key bindings ([see below](#autocomplete-preview))
   108  
   109  * `f9`: show the command line preview box. This will output the contents of
   110    your command pipeline ([see below](#command-line-preview))
   111  
   112  ### Autocomplete Preview
   113  
   114  
   115  
   116  The autocomplete preview is a way of quickly examining the contents of a
   117  function, man page, text file or even image, based on what autocomplete
   118  suggestion is highlighted. ([read more](interactive-shell.md#autocomplete-preview))
   119  
   120  While the preview box is open, the rest of your terminal output will be hidden.
   121  However once you close it, that output will reappear.
   122  
   123  While the preview box is open, the following keys are assigned roles:
   124  
   125  * `f1` or `enter`: closes the preview box
   126  
   127  * `f9` switches to command line preview
   128    
   129  * `page up` scroll up the contents of the preview box, one page at a time
   130  * `ctrl`+`arrow up` scroll up the contents of the preview box, one page at a
   131    time (IBM keyboard layouts)
   132  * `option`+`arrow up` scroll up the contents of the preview box, one page at a
   133    time (Apple keyboard layouts)
   134  
   135  * `page down` scroll down the contents of the preview box, one page at a time
   136  * `ctrl`+`arrow down` scroll down the contents of the preview box, one page at
   137    a time (IBM keyboard layouts)
   138  * `option`+`arrow down` scroll down the contents of the preview box, one page
   139    at a time (Apple keyboard layouts)
   140  
   141  ### Command Line Preview
   142  
   143  
   144  
   145  The command line preview enables you to view the output of a command pipeline
   146  interactively while you type it. ([read more](interactive-shell.md#command-line-preview))
   147  
   148  While the preview box is open, the rest of your terminal output will be hidden.
   149  However once you close it, that output will reappear.
   150  
   151  While the preview box is open, the following keys are assigned roles:
   152  
   153  * `f1` or `enter`: closes the preview box
   154  
   155  * `f9` re-runs the command line and thus updates the contents in the preview
   156    frame
   157    
   158  * `page up` scroll up the contents of the preview box, one page at a time
   159  * `ctrl`+`arrow up` scroll up the contents of the preview box, one page at a
   160    time (IBM keyboard layouts)
   161  * `option`+`arrow up` scroll up the contents of the preview box, one page at a
   162    time (Apple keyboard layouts)
   163  
   164  * `page down` scroll down the contents of the preview box, one page at a time
   165  * `ctrl`+`arrow down` scroll down the contents of the preview box, one page at
   166    a time (IBM keyboard layouts)
   167  * `option`+`arrow down` scroll down the contents of the preview box, one page
   168    at a time (Apple keyboard layouts)
   169  
   170  ### Search Shell History
   171  
   172  This displays up your timestamped shell history as an autocomplete list with
   173  fuzzy find activated. Using `ctrl`+`r` you can rapidly rerun previous
   174  command lines.
   175  
   176  From here, the usual autocomplete / fuzzy find hotkeys apply. Such as pressing
   177  `esc` to cancel history completion.
   178  
   179  If the prompt line is not empty, then the current line is included in the
   180  history search.
   181  
   182  ### Line Editing
   183  
   184  These are the various hotkeys and editing modes available in Murex's
   185  interactive command prompt.
   186  
   187  #### Navigation
   188  
   189  * Arrow keys, `left` and `right`: move the cursor forwards or backwards in line
   190    
   191  * Arrow keys, `up` and `down`:
   192    - If the command line spans multiple lines on the screen then this will jump
   193      up or down to the next/previous line.
   194    - When at the top or bottom line, or the command line is only one line long,
   195      the `up` or `down` keys will search through your history of past command
   196      lines that are similar to your current command line.
   197    - If your command line is empty, then the `up` or `down` keys will search
   198      through every command line in your history.
   199  
   200  * `alt`+`b`: jump backwards a word at a time (Emacs compatibility)
   201  * `ctrl`+`left`: jump backwards a word at a time (IBM keyboard layouts)
   202  * `option`+`left`: jump backwards a word at a time (Apple keyboard layouts)
   203    
   204  * `alt`+`f`: jump forwards a word at a time (Emacs compatibility)
   205  * `ctrl`+`right`: jump forwards a word at a time (IBM keyboard layouts)
   206  * `option`+`right`: jump forwards a word at a time (Apple keyboard layouts)
   207  
   208  * `ctrl`+`a`: jump to beginning of line
   209  * `home`: jump to beginning of line
   210  
   211  * `ctrl`+`e`: jump to end of line
   212  * `end`: jump to end of line
   213  
   214  * `ctrl`+`z`: while readline is open will undo the previous key strokes
   215  
   216  #### General Hotkeys
   217  
   218  * `ctrl`+`k`: clears line after cursor
   219    
   220  * `ctrl`+`u`: clears the whole line
   221  
   222  ### Vim Keys
   223  
   224  Pressing `esc` while no autocomplete suggestions are shown will switch the
   225  line editor into **vim keys** mode.
   226  
   227  Press `i` to return to normal editing mode.
   228  
   229  #### Supported Keys
   230  
   231  * `a`: insert after current character
   232  * `A`: insert at end of line
   233  * `b`: jump to beginning of word
   234  * `B`: jump to previous whitespace
   235  * `d`: delete mode
   236  * `D`: delete characters
   237  * `e`: jump to end of word
   238  * `E`: jump to next whitespace
   239  * `h`: previous character (like `left`)
   240  * `i`: insert mode
   241  * `I`: insert at beginning of line
   242  * `l`: next character (like `right`)
   243  * `p`: paste after
   244  * `P`: paste before
   245  * `r`: replace character (replace once)
   246  * `R`: replace many characters
   247  * `u`: undo
   248  * `v`: visual editor (opens line in `$EDITOR`)
   249  * `w`: jump to end of word
   250  * `W`: jump to next whitespace
   251  * `x`: delete character
   252  * `y`: yank (copy line)
   253  * `Y`: same as `y`
   254  * `[`: jump to previous brace
   255  * `]`: jump to next brace
   256  * `$`: jump to end of line
   257  * `%`: jump to either end of matching bracket
   258  * `0` to `9`: repeat action _n_ times. eg `5x` would delete (`x`) five (`5`)
   259    characters
   260  
   261  ### Recalling Previous Words
   262  
   263  * `shift`+`f1` recalls the first word
   264  * `shift`+`f2` recalls the second word
   265  * ...
   266  * `shift`+`f12` recalls the twelfth word
   267  
   268  In the following example, code inside square brackets represent key presses
   269  rather than text:
   270  
   271  ```
   272  » echo two three four five six seven eight nine
   273  two three four five six seven eight nine
   274  » [shift+f1]echo [shift+f5]five
   275  ```
   276  
   277  ## Job Control
   278  
   279  While processes are running, the following keys are assigned roles:
   280  
   281  * `ctrl`+`c`: kill foreground process. Pressing this will send a kill (SIGINT)
   282    request to the foreground process
   283  
   284  * `ctrl`+`\`: kill all running processes in current shell session, including
   285    any background processes too. This hotkey is a effectively an emergency kill
   286    switch to bring you back to the command prompt should `ctrl`+`c` prove
   287    ineffective. Use this sparingly because it doesn't allow processes to end
   288    gracefully
   289  
   290  * `ctrl`+`z`: suspend foreground process. This will take you back to the prompt
   291    and from there you can then use job control to resume execution in either the
   292    foreground or background. ([read more](../commands/fid-list.md))
   293  
   294  ## Miscellaneous
   295  
   296  ### Cancel Prompt
   297  
   298  Pressing `ctrl`+`c` while on the prompt will clear the prompt. This is similar
   299  to `ctrl`+`u`.
   300  
   301  ### End Of File
   302  
   303  Pressing `ctrl`+`d` on an empty prompt will send EOF (end of file). This will
   304  exit that running shell session.
   305  
   306  ### Alternative Cancel Key
   307  
   308  `ctrl`+`g` performs the same action as `esc` at all states of the interactive
   309  shell.
   310  
   311  ### Clear Screen
   312  
   313  Pressing `ctrl`+`l` will clear the screen.  
   314  
   315  ### EDITOR
   316  
   317  Sometimes you might want to type your command line in a different editor. You
   318  can do via via `esc` followed by `v`.
   319  
   320  You will need to have an environmental variable named `$EDITOR` set to the file
   321  name and path of your preferred editor, otherwise Murex will default to `vi`.
   322  
   323  (this feature is not currently available on Windows)
   324  
   325  ## See Also
   326  
   327  * [Interactive Shell](../user-guide/interactive-shell.md):
   328    What's different about Murex's interactive shell?
   329  * [Rosetta Stone](../user-guide/rosetta-stone.md):
   330    A tabulated list of Bashism's and their equivalent Murex syntax
   331  * [Spellcheck](../user-guide/spellcheck.md):
   332    How to enable inline spellchecking
   333  
   334  <hr/>
   335  
   336  This document was generated from [gen/user-guide/terminal-keys_doc.yaml](https://github.com/lmorg/murex/blob/master/gen/user-guide/terminal-keys_doc.yaml).