Brian Clapper 6 years ago in Plugin announcements • updated by Kai Grossjohann 6 years ago 1
GNU Emacs has a useful feature that allows an individual file to override the default Emacs mode (and, hence, the associated language syntax and colorization) by using a special magic string somewhere in the first non-blank line of the file. For instance, if file foo.C would normally be displayed using C syntax rules, but you want to force Sublime Text 2 to use C++ rules, simply include a comment like this in the first non-blank line of the file:

//           -*- c++ -*-

This feature is useful for overriding the default language on a per-file basis.

I've implemented a plugin that provides this capability. It's in this GitHub repo:
There are packages for Emacs-like mode lines and for vim-like mode lines, so I guess this is already done.