Keyboard Support

Contact and Search Homepage

Header bottom

On this page

(image: Keyman icon)Rules


A rule is the basic part of a Keyman keyboard. Each rule defines what a keystroke will output, when certain characters are already displayed on the screen. A rule is also used to pre-processand post-process the characters being output to the screen.

Using Rules

A rule is made up of three parts:

context + keystroke > output

The context refers to what is already displayed on the screen. A rule will only be firedif the context and the keystroke both match. The output will replace the context matched onthe left hand side of the rule.

In advanced groups, the keystroke section of the rule may be omittedfor processing on the context and output.

Some of the important functions that can be used in rules are context, nul and beep.


The context keyword will transfer the context of the rule into the output, for example:

"abc" + "d" > context "D"

will, when "abc" is on the screen, and "d" is pressed, replace "abc" with "abcD".You can also put a single character from the context into the output using context(n):

"abc" + "d" > "D" context(2)This will output "Db" when "abcd" is typed.


nul is used in the output of a rule to give the rule no output. For instance, the backslash key maybe invalid in the keyboard you are creating, so the following rule will mean it will never have any output:

+ '\' > nul


beep is the same as nul, except that the computer will emit a beep sound at the same time toalert the user to the error. Youcan use this, for instance, when the user types the same diacritic twice in a row:

'' + '`' > context beep

The context statement is required here so that the rule does not delete the "" character.


If you have any feedback or questions, just fill in this form to get in touch.