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
|
.. _config.key_bindings:
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
.. sourcecode:: ini
[bindings]
T = search tag:todo
[[search]]
t = toggletags todo
.. _modes:
Known modes are:
* bufferlist
* envelope
* namedqueries
* search
* taglist
* thread
Have a look at `the urwid User Input documentation <https://urwid.org/manual/userinput.html>`_ on how key strings are formatted.
.. _config.key-bingings.defaults:
Default bindings
----------------
User-defined bindings are combined with the default bindings listed below.
.. literalinclude:: ../../../alot/defaults/default.bindings
:language: ini
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
=========================== ========
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.
.. sourcecode:: ini
[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.
|