3.4. Key Bindings

If you want to bind a command to a key you can do so by adding the pair to the [bindings] section. This will introduce a global binding, that works in all modes. To make a binding specific to a mode you have to add the pair under the subsection named like the mode. For instance, if you want to bind T to open a new search for threads tagged with ‘todo’, and be able to toggle this tag in search mode, you’d add this to your config

[bindings]
  T = search tag:todo

  [[search]]
  t = toggletags todo

Known modes are:

  • bufferlist
  • envelope
  • namedqueries
  • search
  • taglist
  • thread

Have a look at the urwid User Input documentation on how key strings are formatted.

3.4.1. Default bindings

User-defined bindings are combined with the default bindings listed below.

up = move up
down = move down
page up = move page up
page down = move page down
mouse press 4 = move up
mouse press 5 = move down
j = move down
k = move up
'g g' = move first
G = move last
' ' = move page down
'ctrl d' = move halfpage down
'ctrl u' = move halfpage up
@ = refresh
? = help bindings
I = search tag:inbox AND NOT tag:killed
'#' = taglist
shift tab = bprevious
U = search tag:unread
tab = bnext
\ = prompt 'search '
d = bclose
$ = flush
m = compose
o = prompt 'search '
q = exit
';' = bufferlist
':' = prompt
. = repeat

[bufferlist]
    x = close
    enter = open

[search]
    enter = select
    a = toggletags inbox
    & = toggletags killed
    ! = toggletags flagged
    s = toggletags unread
    l = retagprompt
    O = refineprompt
    | = refineprompt

[envelope]
    a = prompt 'attach ~/'
    y = send
    P = save
    s = 'refine Subject'
    f = prompt 'set From '
    t = 'refine To'
    b = 'refine Bcc'
    c = 'refine Cc'
    S = togglesign
    enter = edit
    'g f' = togglesource

[taglist]
    enter = select

[namedqueries]
    enter = select

[thread]
    enter = select
    C = fold *
    E = unfold *
    c = fold
    e = unfold
    < = fold
    > = unfold
    [ = indent -
    ] = indent +
    'g f' = togglesource
    H = toggleheaders
    P = print --all --separately --add_tags
    S = save --all
    g = reply --all
    f = forward
    p = print --add_tags
    n = editnew
    b= bounce
    s = save
    r = reply
    | = prompt 'pipeto '
    t = togglemimetree
    h = togglemimepart

    'g j' = move next sibling
    'g k' = move previous sibling
    'g h' = move parent
    'g l' = move first reply
    ' ' = move next

In prompts the following hardcoded bindings are available.

Key Function
Ctrl-f/b Moves the curser one character to the right/left
Alt-f/b Shift-right/left Moves the cursor one word to the right/left
Ctrl-a/e Moves the curser to the beginning/end of the line
Ctrl-d Deletes the character under the cursor
Alt-d Deletes everything from the cursor to the end of the current or next word
Alt-Delete/Backspace Ctrl-w Deletes everything from the cursor to the beginning of the current or previous word
Ctrl-k Deletes everything from the cursor to the end of the line
Ctrl-u Deletes everything from the cursor to the beginning of the line

3.4.2. Overwriting defaults

To disable a global binding you can redefine it in your config to point to an empty command string. For example, to add a new global binding for key a, which is bound to toggletags inbox in search mode by default, you can remap it as follows.

[bindings]
  a = NEW GLOBAL COMMAND

  [[search]]
    a =

If you omit the last two lines, a will still be bound to the default binding in search mode.