This post explains how to add it to your own game, and also how to invent new shortcuts.
The only new type of shortcut that can be added is to select a certain type of unit. Other shortcuts can be added but require programming knowledge.
Backup your game.prefs, you have the power to do some damage here, possibly crashing FA, definitely destroying your local settings.
Edit your game.prefs, find the UserKeyActions section.
Add an entry like this:
['Select nearest idle t1/t3 scout'] = {action = 'UI_SelectByCategory +nearest +idle AIR INTELLIGENCE', category = 'Custom Keys', order = 1,},
Now start the game, open the keybinding menu, the new action will be listed under a new category called 'custom keys'. Bind the key and you're done.
To make your own selection actions
The entry has this format:
['action name'] = {action = 'lua', category = 'categoryName', order = 1,},
Replace lua with this:
UI_SelectByCategory [modifiers] [categories]
Modifiers can be left out altogether, or you can add them, seperated by a space. Include the + symbol:
+excludeengineers
+nearest
+idle
+goto
+inview
+add
If nearest is not specified it will select all matching units.
Goto will jump the camera
Inview will limit the selection to onscreen units
Add will add to the current selection instead of replacing it
Categories - supply one or more, seperated by a space. If you want everything use the category ALLUNITS.
You can have use comma to indicate OR. So "MOBILE LAND,MOBILE AIR" would take all units that are (mobile and land) or (mobile and air)
Each unit also gets it's own virtual category of it's BlueprintId. So UI_SelectByCategory "url0101,url0103" selects cybran land scouts and medusa
Useful examples of categories are AIR, LAND, COMMAND, RADAR, MOBILE, STRUCTURE
To work out which categories are relevant, you may need to view the unit blueprints. For example with my scout selection I had to view the T3 Spy Plane blueprint to discover it had an INTELLIGENCE category, but no SCOUT category like the old action was using.
The full list of categories is rather large:
Spoiler: show
Some real world keyaction examples:
['goto_commander'] = {action = 'UI_SelectByCategory +nearest +goto COMMAND', category = 'selection', order = 49,},
['select_commander'] = {action = 'UI_SelectByCategory +nearest COMMAND', category = 'selection', order = 50,},
['select_engineers'] = {action = 'UI_SelectByCategory ENGINEER', category = 'selection', order = 45,},
['select_all'] = {action = 'UI_SelectByCategory ALLUNITS', category = 'selection', order = 51,},
For all of the real ones used by the game, inside faforever.nxt, open \lua\keymap\keyactions.lua
To make your own (non selection) actions
You can replace the lua so instead of invoking UI_SelectByCategory, just invoke any lua.
For example, this will make it ai_instaBuild mappable:
['Insta build'] = {action = 'ai_InstaBuild', category = 'Custom Keys', order = 1,},
In case you don't know what instaBuild does, if cheats are enabled, everything you try and build will happen instantly, useful for testing things ... like new hotkeys.
There you have it, you can now select the nearest onscreen idle mass fabricator.
I just hope you use this knowledge for peaceful reasons.