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

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