BindingsEpsilon allows you to create your own commands and attach them, or any pre-existing Epsilon commands, to any key. If you bind a command to a key, you can then invoke that command by pressing the key. For example, at startup, Epsilon has forward-character bound to the Ctrl-F key. By typing Ctrl-F, the forward-character command executes, so point moves forward one character. If you prefer to have the command which moves point to the end of the current line, end-of-line, bound to Ctrl-F, you may bind that there.
You bind commands to keys with the bind-to-key command, which you can invoke with the F4 key. The bind-to-key command asks you for the name of a command (with completion), and the key to which to bind that command. You may precede the key by any number of prefix keys. When you type a prefix key, Epsilon asks you for another key. For example, if you type Ctrl-X, Epsilon asks you for another key. Suppose you type Ctrl-O. Epsilon would then bind the command to the Ctrl-X Ctrl-O key sequence. Prefix keys give Epsilon a virtually unlimited number of keys.
Epsilon at startup provides Ctrl-X and Ctrl-C as the only prefix keys. You can invoke many commands, such as save-file (Ctrl-X Ctrl-S) and find-file (Ctrl-X Ctrl-F), through the Ctrl-X prefix key. You may define your own prefix keys with the command called create-prefix-command. Epsilon asks you for a key to make into a prefix key. You may then bind commands to keys prefixed with this key using the bind-to-key command. To remove prefix keys, see Command File Examples.
When you press a prefix key, Epsilon displays the key in the echo area to indicate that you must type another key. Epsilon normally displays the key immediately, but you can make it pause for a moment before displaying the key. If you press another key during the pause, Epsilon doesn't bother displaying the first key.
You control the amount of time Epsilon pauses using the
mention-delay variable, expressed in tenths of a second. By
default, this variable has a value of zero, which indicates no delay.
You may find it useful to set
mention-delay to a small value (perhaps
The unbind-key command asks for a key and then offers to rebind the key to the normal-character command, or to remove any binding it may have. A key bound to normal-character will self-insert; that's how keys like "j" are bound. A key with no binding at all simply displays an error message.
You may bind a given command to any number of keys. You may invoke a command, whether or not bound to a key, using named-command, by pressing the Alt-X key. Alt-X asks for the name of a command, then runs the command you specified. This command passes any numeric argument you give it to the command it invokes. (Alt-X, like binding, also works with keyboard macros. And it works with any EEL subroutine that takes no parameters, even if it was not defined using the "command" keyword.)
Some keys behave differently in different contexts. For instance, the n key in dired mode moves down one line instead of inserting an "n" as it does in Fundamental mode. Every mode has a key table that defines which keys have "custom" bindings for that mode. Epsilon uses other key tables when you're typing a response at a prompt, or scrolling through a list of choices. You can customize those bindings too.
The bind-to-key command modifies the current mode's key binding if the selected key has a mode-specific binding in the current mode. If not, it modifies the global key table, so the binding applies to all modes.
To interactively create a new mode-specific binding, or change the bindings of keys in special modes like the ones used for prompts, the easiest method is to use the list-all and load-buffer commands. The former lists all the current bindings, so you can see the names of the internal commands run by each key and combine the lines to specific the bindings you want.
For example, at many prompts "?" lists possible responses. Say you want the F8 key to do this too. In most contexts, F8 runs the set-variable command. Examine the output of list-all and you'll find lines like these:
The command alt-prefix, bound to <Esc>, gets another key and executes the command bound to the Alt version of that key. You will find this command useful if you must use Epsilon from a keyboard lacking a working Alt key, or if you prefer to avoid using Alt keys. Also, you may find some combinations of control and alt awkward to type on some keyboards. For example, some people prefer to invoke the replace-string command by typing <Esc> & rather than by typing Alt-&.
The command ctrl-prefix, bound to Ctrl-^, functions similarly. It gets another key and converts it into the Control version of that key. For example, it changes "s" into the Ctrl-S key.
Some key combinations are variations of other key combinations. For instance, <Backspace> and Ctrl-H are related in this way. Epsilon uses a notion of generic versus specific keys; for instance, the specific key <Backspace> is also generically a Ctrl-H key. If you bind this key to a new command, Epsilon will ask if you want to bind only the <Backspace> key, or all key combinations that generate a Ctrl-H.