In VIM one can force a file type by writing a modeline like this
# vim:syntax=html filetype=html
I'ld like to obtain the same thing for Sublime Text. For example I'ld like Sublime Text 2 to use MarkDown syntax for some file I have with .txt extension.
There is a Modelines plugin for Sublime Text: https://github.com/SublimeText/Modelines
To do this for every file with a specific extension, with a file open go to menu View
, Syntax
, Open all with current extension as...
and set your preference there.
It doesn't seem to be possible natively to set it per file or project, but propably you should take a look at this package: https://github.com/phillipkoebbe/DetectSyntax
Another one available in package control for ST2/3 is https://github.com/kvs/STEmacsModelines
using it is very simple, from the docs:
Somewhere within the first five lines of a file, add a line matching the following:
-*- key: value; key2: value2 -*-
or
-*- syntax -*-