Binding a Minecraft command to a key
It seems that Single Player Commands has finally been updated to 1.6.4 (of course MC 1.7.2 is out now…)
With this, you can bind commands to keys as so:
/bind y gamemode 1
You can also use /bindid
to set a special key via its key-code. It can’t quite do something like toggling (which would require knowing or keeping track of the current state), but it does let you bind a key to a macro (with the /macro
command), so it might be possible to cobble together something that can toggle, but even if not, it’s still a perfectly suitable solution for most applications. (In the case of switching modes, Tab can be bound to creative mode to quickly avoid dying and then switching back to survival can be done with another key or manual.)