I can't seem to find the original topics discussing this (may have been just a part of other discussions?), but I certainly agree to the usefulness.
To expand, possible examples of how it could work:
Each
command would have a "hotkey" element which specifies the key in the same syntax as the hotkey INI.
Example:
<command>
<type value="attack"/>
<name value="attack"/>
<image path="images/swordman_attack.bmp"/>
<unit-requirements/>
<upgrade-requirements/>
<move-skill value="charge_skill"/>
<attack-skill value="attack_skill"/>
<hotkey value="Ctrl+A"/>
</command>
For "submenu" style commands, such as build, produce, etc, you'd have a new attribute to specify the hotkey. So if your produce skill creates a submenu for produced units, each "produced-unit" tag would have a "hotkey" attribute added.
<command>
<type value="produce" />
<name value="produce" />
<image path="images/image.bmp" />
<unit-requirements>
<unit name="my_unit" />
</unit-requirements>
<upgrade-requirements>
<upgrade name="my_upgrade" />
</upgrade-requirements>
<produce-skill value="produce_skill" />
<produced-units>
<produced-unit name="my_unit" number="1" hotkey="Alt+M" />
</produced-units>
</command>
It'd be more versatile to specify the hotkey on the commands than in the unit's parameters, as it would allow us to add hotkeys to, say, secondary attacks. Naturally, all hotkey elements/attributes would be optional.
If the given hotkey attribute is the same as one defined in keymap.ini, the mod-defined hotkey will prevail (but we'll assume that modders will be smarter than to try and "overwrite" popular hotkeys, eg, no making the move command have the hotkey of "a"). The reason for this is to allow modders more choice, but does require them to be responsible about their choices. Ideally, very few clashes should exist, but there may be legitimate uses, such as making a different attack skill have the hotkey for "a", or perhaps on a building, "m" might be the production hotkey, even though buildings won't have the move command usually associated with "m".
Personally, I'd recommend that modders never overwrite the default keymap.ini hotkeys unless absolutely necessary. You can easily add
Ctrl and
Alt modifiers to hotkeys, which (currently) the keymap.ini doesn't use at all. It'd also be a good idea for modders to be consistent with their hotkeys. For example, don't use "a" to produce a unit, since "a" would generally be associated with some type of attack. While it's good to use letters similar to the action being performed (eg, copy is Ctrl+C), if there isn't any "empty" slots (eg, you already used "Y", "Shift+Y", "Alt+Y", and "Ctrl+Y" as hotkeys for other actions), it's not necessary (eg, to close a window, Ctrl+W and Alt+F4 are the hotkeys, despite neither seeming to be even slightly related to closing a window).
With the hotkeys being the same as used in the keymap.ini file, the possibilities are as described on the
Wiki page (not entirely sure how up to date it is, more keys may be supported). On a side note, it'd be nice if the function keys and number pad number keys could be used, as they are marked as "crash" on that page.