You can download it evaluating
(ConfigurationOfKeymapping project version: #stable) load
What does it have now?
- Can provide settings for a set of morphs.
When you declare a keymap, it has a category. It's just a way to classify keymaps. Then, you can attach a category to some morph classes, and it's instances will be reacting to the keymaps in that shortcut.
- Can provide settings for a TextMorph's editor(SmalltalkEditor and related)
Categories are attached to Keymap targets. Those targets are the ones on which the keymap is executed in case it's shortcut is pressed.
By default, a Morph is the target for it's keymaps, but we decide, for example, that the target for TextMorph's keymaps is it's editor. That's what its done in order to attach keymaps to the editors :).
- Settings integration
I've slightly modified Pharo's setting tree using extension methods, in order to support a way to declare a keymap setting without referencing any Keymapping class.
Keymap settings are shown on the Settings browser as a special morph who allows us to edit the keymap typing the key combination.
How do we declare a Keymap?
Downloading the library from it's metacello config, will download for us two classes that show examples: KMToolsDefaultSettings and KMEditorsDefaultSettings.
And easy example of how to declare a keymapping is:
(aBuilder group: #Editors)
label: 'Editors' translated;
description: 'Editors shortcuts' translated;
(aBuilder shortcut: #browseIt)
"this is the keymap category"
default: $b meta;"I'm te default shortcut for the keymap"
do: [ :e | e browseIt ];"I'm the action to evaluate when I'm pressed"
label: 'browse it' translated;
description: 'editor shortcut to browse a piece of code' translated.
aBuilder attachShortcutCategory: #SmalltalkEditor to: SmalltalkEditor.
"This is the way we attach a category to a target class"
The most annoying thing there is the $a meta. WTF is that?
$a meta is the equivalent to Meta + $a.
Other key combinations you can build are:
1 cmd --> Cmd + 1
$b meta shift --> Meta + Shift + b
$a meta shift , $c cmd shift --> Meta + Shift + a, Cmd + Shift + c