Added OS detection, moved some stuff into OS specific sections.
Added scratch buffer handling.

CTRL-SHIFT-S either opens a new scratch buffer or splits the screen and
loads the existing scratch buffer.
Cleaned up after adding scratch buffer code