Insert repl options at top of file based on user's choices.

Also rely less on global options.
Fixes #1213.
The style we've been using is to use a new line between each of these if there is more than one import.