7

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.

3 Answers 3

5

There is a Modelines plugin for Sublime Text: https://github.com/SublimeText/Modelines

Sign up to request clarification or add additional context in comments.

Comments

4

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

Comments

1

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 -*-

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.