Enhance line-endings handling (CRLF / LF).

Fix auto-indent not working in Linux (and presumably Mac OS X).
Add config option to choose default EOL for new files.
Add EOL auto-detection for existing files.