detect file type and set editor mode accordingly