https://lynx.invisible-island.net/lynx_help/keystrokes/bashlike_edit_help


Lynx Line Editor Bash-Like Key Binding

Overview

Lynx invokes a built-in Line Editor for entering strings in response to prompts, in forms, and for email messages if an external editor has not been defined. Alternative key bindings are normally available (unless Lynx was configured with --disable-alt-bindings). If available, they may be selected via the “o”ptions menu, or by editing lineedit_mode in the “.lynxrc” file.

You can always see the current set of key-bindings in Lynx by opening the special URL LYNXEDITMAP:. This page is provided for those not using Lynx.

Note: setting emacs/vi keys ON has no direct effect on line-editor bindings.

Bash-like bindings

This is the Bash-like Binding keymap.

     ENTER  Input complete        -  Enter, RETURN
     TAB    Completion / Next     -  TAB, Do (see note 2)
     ABORT  Cancel / Undo Change  -  Ctrl-g, Ctrl-_
     ERASE  Erase the line        -  M-k, Ctrl-x k

     BACK   Cursor back     char  -  Left-Arrow,  Ctrl-b
     FORW   Cursor forward  char  -  Right-Arrow, Ctrl-f
     BACKW  Cursor back     word  -  M-b, Ctrl-r
     FORWW  Cursor forward  word  -  M-f, Ctrl-s (see note 5)
     BOL    Go to begin of  line  -  Ctrl-a, Home, Find
     EOL    Go to end   of  line  -  Ctrl-e, End,  Select (see note 4)

     DELP   Delete prev     char  -  Backspace
     DELN   Delete next     char  -  Ctrl-d, Delete, Remove (see note 1)
     DELPW  Delete prev     word  -  Ctrl-w, M-Backspace, M-Delete (see note 3)
     DELNW  Delete next     word  -  M-d
     DELBL  Delete to beg of line -  Ctrl-u
     DELEL  Delete to end of line -  Ctrl-k (see note 4)

     UPPER  Upper case the line   -  M-u
     LOWER  Lower case the line   -  M-l

     LKCMD  Invoke cmd prompt     -  Ctrl-v [FORM] (see note 6)
     SWMAP  Switch input keymap   -  Ctrl-^ (if compiled in)

Special commands for use in textarea fields [FORM]:

     PASS!  Textarea external edit  - Ctrl-e Ctrl-e, Ctrl-x e (see note 4)
     PASS!  Insert file in textarea - Ctrl-x i
     PASS!  Grow textarea           - Ctrl-x g

Try it yourself

Here is a little textarea for practice:

Emacs-like commands

    TPOS    Transpose characters                   -  Ctrl-t
    SETMARK Set mark at current position in line   -  Ctrl-@
    XPMARK  Exchange current position with mark    -  Ctrl-x Ctrl-x
    KILLREG Kill region between mark and position  -  Ctrl-x Ctrl-w (see note 3)
    YANK    Insert text last killed (with KILLREG) -  Ctrl-y

Special keys

See the Lynx Line Editor page for an explanation of terminology and key-names.

Notes

  1. "next" means the character "under" a box or underline style cursor; it means "to the immediate right of" an I-beam (between characters) type cursor.
  2. For entering strings in response to prompts (that is, when not editing form text fields), some keys have different actions: TAB tries to complete input based on previous response; Up-Arrow and Down-Arrow may offer previous response and next response, respectively, from recall buffer for some prompts.
  3. Ctrl-w can only be used for editing functions if its default KEYMAP to REFRESH is changed. This can be done in the lynx.cfg file, for example with the line "KEYMAP:^W:DO_NOTHING". This also applies for other keys: as long as the key's action is mapped to REFRESH, either with an explicit KEYMAP in lynx.cfg or by default, the key's Line Editor binding is disabled.
  4. These keys invoke special behavior when pressed twice in a row: Ctrl-e Ctrl-e calls the external editor for changing the text in a textarea (if available). Ctrl-k Ctrl-k will move to the next link, so that all lines in a textarea can be conveniently cleared by repeating Ctrl-k.
  5. Key is likely unavailable for Lynx, because it is interpreted by operating system, comm program, or curses library, or swallowed as part of escape sequence recognition. Binding is provided for the benefit of those where this does not apply.
  6. where [FORM] is marked, indicates that the binding is effective only in form text fields. It is ignored by Line Editor elsewhere.

When a text input field, including a textarea line, is selected, the Line Editor functions get a first grab at the keys entered. If a key has no function defined in the Line Editor binding, it can either be ignored, or passed on for normal key command handling, where modifiers like Ctrl-x or Meta currently have no effect (see the Key Map Page accessible with the key K for current information).

Additional details

Here are some additional details on other keys, for the curious (very much subject to change)

Normal key action when used in form fields, subject to remapping
with KEYMAP: [FORM (except Up-Arrow, Down-Arrow)]
            Ctrl-l (see note 3)
            Ctrl-o, Ctrl-z, Ctrl-\, Ctrl-] (see note 5)
            Ctrl-n [emacskey], Ctrl-p [emacskey]
            Up-Arrow, Down-Arrow (see note 2)
            Page-Up, Page-Down, F1, Back-Tab

Normal key command with Meta modifier ignored when used in form fields,
subject to remapping with KEYMAP: [FORM (except Up-Arrow, Down-Arrow)]
            M-Ctrl-l (see note 3) M-Ctrl-o [!],
            M-Ctrl-z, M-Ctrl-\, M-Ctrl-] (see note 5)
            M-Ctrl-u, M-/, M-n
            M-Up-Arrow [!], M-Down-Arrow [!] (see note 2)
            M-Page-Up [!], M-Page-Down [!], M-Home, M-End

Passed as specific command:
                        lynx action    duplicates by default
                        -----------    ---------------------
            M-Ctrl-d    NEXT_LINK      Down-Arrow
            M-Ctrl-e    EDITTEXTAREA   Ctrl-e Ctrl-e
            M-Ctrl-k    LPOS_NEXT_LINK (none, Down-Arrow suggested)
            M-e         EDITTEXTAREA   Ctrl-e Ctrl-e
            M-g         GROWTEXTAREA   (none, Ctrl-v $ suggested?)
            M-i         INSERTFILE     (none, Ctrl-v # suggested?)
            M-<        HOME           M-Home
            M->        END            M-End
            M-F1        DWIMHELP       F1
            M-Find      WHEREIS        Ctrl-v /
            M-Select    NEXT           Ctrl-v n

Duplicates function of other key(s):
                        edit action    duplicates
                        -----------    ----------
            M-Ctrl-b    BACKW          M-b, Ctrl-r
            M-Ctrl-f    FORWW          M-f
            M-Ctrl-n    FORWW          M-f
            M-Ctrl-p    BACKW          M-b, Ctrl-r
            M-Ctrl-r    BACKW          M-b, Ctrl-r
            M-a         BOL            Ctrl-a, Home, ...

Modifier ignored, and duplicates function of other key(s):
                        edit action    duplicates
                        -----------    ----------
            M-Ctrl-a    BOL            Ctrl-a, Home, ...
            M-Ctrl-g    ABORT          Ctrl-g, ...
            M-TAB       TAB            Ctrl-i [!]
            M-Ctrl-j    ENTER          Ctrl-m, Ctrl-j, Enter / RETURN
            M-RETURN    ENTER          Ctrl-m, Ctrl-j, Enter / RETURN
            M-Ctrl-y    YANK           Ctrl-y [!]
            M-Ctrl-^    SWMAP          Ctrl-^ [!] (if compiled in)
       M-Right-Arrow    FORW           Right-Arrow [!], Ctrl-f
        M-Left-Arrow    BACK           Left-Arrow [!],  Ctrl-b
            M-Do        TAB            Ctrl-i [!]

Key completely ignored:
            Ctrl-q, Insert
            M-Ctrl-q, M-Ctrl-s, M-Ctrl-t, M-Ctrl-v, M-ESC (see note 5)
            M-Ctrl-@, M-Ctrl-_, M-Remove, M-Insert [!]

Meta + other (mostly, printable character) keys:
              Modifier ignored, or sequence swallowed (see note 5).
            M-@, M-E...M-Z, M-\, M-^, M-_ attempt to interpret
              as 7-bit escape representation for character in 8-bit
              control (C1) range if appropriate according to
              Display Character Set.

[emacskey] Normal key action subject to emacs_keys setting.

[!] Action of key with Meta modifier follows action of key without
    Meta.  If you manage to enter the Meta key while Line-Editor
    Binding is not set to Bash-Like, and the unmodified binding
    is different from that listed here, M-<key> will act
    like <key>.