Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I set syntax to PHP in Sublime, all thing is good in my PHP code:

code with syntax highlighted

But when I remove <?php tag from my code, the syntax highlighter doesn't work anymore:

code without syntax highlighted

How can I tell sublime to do syntax highlighting on this specific file (my file extension is .code)?

share|improve this question
    
I second the problem. even I have the same issue. –  vishal Jul 24 '13 at 16:51

2 Answers 2

Put #<?php at the top of the file. PHP will treat it as a comment. Sublime won't. Perfect.

share|improve this answer

With your file open, from the View menu, choose Syntax.... Choose one of the options to set the syntax for that file only. Or, choose Open All with Current Extension As... to specify that all .code files should use the PHP syntax.

share|improve this answer
    
I did it before and the Syntax is set to PHP. The problem is because my file doesn't contains <?php tag, the Sublime Text won't highlight my code. –  user2480690 Jun 28 '13 at 7:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.