Format Selection and Grammar Detection

Hi again,

I've repackaged my previous pull request without 'format on save'. This one adds grammar detection instead of sniffing the file extension from the title and also adds formatting of the current selection(s).