Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Repeating Commands
         Repeating a Single Command
         Keyboard Macros
      Simple Customizing
         Bindings
         Brief Emulation
         CUA Keyboard
         . . .
      Advanced Topics
         Changing Commands with EEL
         Updating from an Old Version
         Keys and their Representation
         Customizing the Mouse
      . . .

Previous   Up    Next
Keyboard Macros  Commands by Topic   Brief Emulation


Epsilon User's Manual and Reference > Commands by Topic > Simple Customizing >

Bindings

Epsilon 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 3). This delay applies in most situations where Epsilon prompts for a single key, such as when entering a numeric argument.

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:

~reg-tab "F-8": set-variable
...
~comp-tab "?": inp-show-matches

The first defines the usual binding for F8, showing how to specify that key in command line syntax, as F-8. The second specifies the binding for "?" at prompts, showing that it runs the internal function inp-show-matches. So combine them into

~comp-tab "F-8": inp-show-matches

Put the above line in a buffer and run Alt-x load-buffer on it, and now F8 at prompts will display matches. Put that line in your einit.ecm file (see Saving Customizations) and Epsilon will load the binding every time it starts up.

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.

Standard bindings:

  Alt-x, F2  named-command
 F4  bind-to-key
   create-prefix-command
   unbind-key
 <Esc>  alt-prefix
 Ctrl-^  ctrl-prefix
 



Previous   Up    Next
Keyboard Macros  Commands by Topic   Brief Emulation


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.