Keybind
To bind actions to keys use
bind KEY ACTION
where KEY is a registered key-alias (see config/keymap.cfg) and ACTION is any CubeScript block you'd like to execute upon keypress.
For example the default bindings for movement (WASD) are
bind W forward bind A left bind S backward bind D right
To be sure - the words forward, left, backward and right in this case represent valid CubeScript commands. In case you want to do more complex things than calling a simple CubeScript command you will need to enclose the block in quotes; there are two types of quotes in CubeScript - the regular double-quote (") and the square brackets ([ and ]).
As an example:
bind 5 "say LOL" // or bind 5 [say "LOL! :)"]
This will make you laugh-out-loud (LOL) whenever you press your number-key "5" (not the one on the numeric-keypad BTW, that's called KP5).
As always your personal configuration should reside in config/autoexec.cfg, binding keys while playing is done via the Console. However, when entering binds into the console, you have to prefix it with a forward slash.
>/bind 5 "say LOL"