Keybind file

From Zero-K
Jump to: navigation, search

ZK uses a Lua configuration file to store keybinds. It can be found at <ZK folder>\LuaUI\Configs\zk_keys.lua


Level 1 - Basic Usage[edit]

You don't need to edit this file. You can simply use the ingame menu to set hotkeys to commands and they will be saved to this file on exit. You may wish to occasionally save this file to a secure place in case you anticipate reinstalling the game.

Level 2 - Advanced Usage[edit]

Some people might want a little more control over the keybinds. There are two scenarios where you'd need to edit the file. Only edit the file when you're not running the game, otherwise your changes will get lost.

(1) Binding Multiple Keybinds to a Single Action[edit]

You might want to bind 2 or more key combos to a single action, which cannot be done in the game. Edit the file like the following example:

{ "attack", {"a","q","c+w"} },

This will bind three key combos to the attack command. A, Q and ctrl+W.

(2) Controlling Order of Multiple Actions That Use The Same Keybind[edit]

You can use the ingame menu to bind the same keycombo to different actions, but you cannot control the order in which they are active. For example you may want to bind "attack" and "fight" both to "A" but you want to make sure the fight command is always active on the first time you hit A, and attack second. Edit the file like the following example:

{ "fight", "a", }, { "attack", "a", },

Level 3 - uikeys.txt Migration[edit]

If you've set up a lot of keybinds in the Spring engine's uikeys.txt and you don't wish to use the ingame menu to rebind them, you can migrate your keybinds using a text editor. As an example, the following search/replace string pair (in Komodo Edit) does a decent job of converting keybindings from uikeys that you can paste into the keybind file:


  { "\2", "\1" },

Once you've pasted this new text, you'll likely need to refer back to Level 2 for the scenarios where you'll need to further modify the file. For example, two separate lines with the same action won't work, you'll need to combine them into one line.

Disregard any "unbind" commands; They no longer apply.

Level 4 - uikeys.txt Purists[edit]

If you absolutely refuse to use the new system and you wish to continue using the engine's uikeys.txt file, you can configure the game to use it. This is not recommended, as you lose the ability to bind keys in the menu and have them save over to future games. Apply the following changes:

  • Enable: Settings > Show Advanced Options
  • Enable: Settings > Misc > Use uikeys.txt.
  • Restart spring once.


  • Any (`*`)
  • Alt (A)
  • Ctrl (C)
  • Meta (M)
  • Shift (S)

The special 'Any' modifier makes it so that the keyset matches regardless of the current state of the real modifiers.