Custom keyboard shortcuts

You have learned in this other lesson that recording a macro allows to automate repetitive tasks. In some cases, you'll want the recorded macro to be remembered across editing sessions and you'll also want to trigger the execution of this macro by pressing a sequence of one or more keystrokes.

This can be done by selecting OptionsCustomize ConfigurationAdd Keyboard Shortcut. This menu item displays the following dialog box:

The "Add keyboard shortcut" dialog box

Using this dialog box is simple in its principle:

  1. First specify a sequence of one or two keystrokes. A keystroke is specified by the name of a keyboard key (e.g. F7), optionally associated to a modifier key (e.g. Ctrl), or by a typed character (e.g. "}").
  2. Then specify the command which is to be executed when the chosen keystrokes have been pressed.

This dialog box has a "Last recorded macro-command" option which allows to specify that the command to be executed is the last recorded macro-command.

Another easy to use option consists in binding the chosen keystrokes to one of the last executed commands. The "Choose from last executed commands" button displays the list of last executed commands (when an executed command is “repeatable”).

The "Choose from last executed commands" dialog box

More generally, you'll have to specify the name of a command (e.g. "insert") and also, optionally, the parameter —a text string— passed to this command (e.g. "into {http://docbook.org/ns/docbook}olink"). XMLmind XML Editor commands are all documented in XMLmind XML Editor - Commands. This document is directly available from within the dialog box (The "link to documentation" button Documentation).

You'll find in the table below, some very useful examples of what you can do using this Add Keyboard Shortcut facility.

Keystroke Command Parameter Description
-
(minus)
insertCharSequence - mdash Typing a single "-" inserts a "-" character. Typing two "-" in a row inserts a "" character (em dash).
`
(backquote)
insertCharSequence ` 0x201c Typing a single "`" inserts a "`" character. Typing two "`" in a row inserts a "" character (opening quotation mark).
'
(quote)
insertCharSequence ' 0x201d Typing a single "'" inserts a "'" character. Typing two "'" in a row inserts a "" character (closing quotation mark).
,
(comma)
insertCharSequence , 0x201e Typing a single "," inserts a "," character. Typing two "," in a row inserts a "" character (German opening quotation mark).
< insertCharSequence < 0x00ab Typing a "<" single inserts a "" character. Typing two "<" in a row inserts a "«" character (opening French guillemet).
> insertCharSequence > 0x00bb Typing a single ">" inserts a ">" character. Typing two ">" in a row inserts a "»" character (closing French guillemet).
) showMatchingChar ) Inserts a closing parenthesis at caret position then, if the corresponding opening parenthesis is found, highlights this character for half a second. If the opening parenthesis is not found, this command emits an audio beep.
} showMatchingChar } See above.
] showMatchingChar ] See above.
Screencast Watch the screencast