kidbrax
kidbrax

Reputation: 2434

in sublime text, is there a way to specify a file type in the file

Is there a way to add a line at the beginning of the file to specify the file type such as the following in emacs or vi:

# -*- mode: ruby -*-
# vi: set ft=ruby :

I would like to be able to set the format of some files that dont have file extensions such as Vagrantfile.

Upvotes: 0

Views: 230

Answers (2)

CHAN
CHAN

Reputation: 1566

Try this two plugins, together they can parse the modelines correctly:

Upvotes: 0

Igor Gassmann
Igor Gassmann

Reputation: 182

In Sublime there is a way to apply syntax highlighting by the file extension. To perform this:

View > Syntax > Open all with current extension as... > [TheSyntaxYouWant]

For the case where you don't have a file extension, you can use some of these plugins that behave like VI or EMACS:

Sublime Modelines

Emacs-like Sublime Modeline

You can also use ApplySintax, but it necessitate to perform some configurations before you can really use it.

Upvotes: 3

Related Questions