'd' key to change default command

We also use a new `AppState` structure to keep all data in one place.
This significantly reduces the number of arguments that, e.g.,
`keyHandler` requires.
doc; abandon code-first policy

This goes against, e.g., Linux Kernel Coding Style's
comment-before-a-function style.