Lumail - The console email client

Lua primitives: keymap

NOTE: Lumail-legacy has been superseded by Lumail 2.x, which has a wholly unified Lua API.

All keybindings are defined via the lua init file(s), vua the global Lua table "keymap".

Currently all keybindings are single characters, although it is possible to bind keys such as "Ctrl-m", or "Ctrl-n", those keys should be written as "^M" and "^N" respectively.

Because only single-keypresses are looked-up it is not possible to bind an action to a multi-part keypress (such as in emacs where you can bind a function to a key-combination such as "Ctrl-x Ctrl-s").

The following is a good introduction to keybindings:

-- Define the main table, and sub-tables for global and per-mode keystrokes.
keymap = {}
keymap['global']  = {}
keymap['index']   = {}
keymap['message'] = {}
keymap['maildir'] = {}

-- The keystroke "Q" will exit in all modes, because we're
-- placing it in the global keymap.
keymap['global']['Q'] = "exit()"

-- The key "Ctrl-N" will cause a new mail to be created.
keymap['global']['^N'] = 'compose();'

-- The function "foo()" will be called if you press "f"
-- in maildir-mode only:
keymap['maildir']['f'] = "foo()"


This function has been available since version 0.07.

See Also

See also global_mode, on_key.