Have the editor keep a stack of modes.
Make more use of modes.

Replace awkward multi-stage motion handling with a series of modes.

Add an "entered" callback on modes. This helps eliminate some
duplication (e.g. writing "-- INSERT --" in the status bar whenever
insert mode is entered), and also sort of allows communication between
modes, as a mode can check when it's entered if e.g. a motion was just
processed.

It's a bit kludgy but it's a bit better than what we had.
Implement named registers.