Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code in a php page:


$query = "
    SELECT data 
    FROM table 
    WHERE param = 1 

Since this sql is wrapped inside quotations in a php document, everything shows up a solid green (or whatever color you have set for a string's syntax highlight).

Is there a way to get sublime text 2 to properly color the sql even with it inside a php string?

share|improve this question

On my Sublime this code works great:

$query = "SELECT data FROM table WHERE param = 1 ";

Don't add new line after '='

share|improve this answer

You will have to edit the PHP.tmLanguage located in Data\Packages\PHP. You should probably set a regex rule (as MySQL queries begin with SELECT/DESCRIBE etc.) and assign proper context.

share|improve this answer

Your Answer


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.