简体   繁体   English

Sublime Text 2 PHP高亮显示

[英]Sublime text 2 php highlighting

How to highlight only php code in Sublime Text 2? 如何在Sublime Text 2中仅突出显示php代码?

At the moment I use this in my theme: 目前,我在主题中使用了它:

<dict>
    <key>name</key>
    <string>Embedded source</string>
    <key>scope</key>
    <string>text source</string>
    <key>settings</key>
    <dict>
        <key>background</key>
        <string>#4d363c</string>
    </dict>
</dict>

works but also it's highlighting javascript and stylesheets.. I want only the php code like Notepad++ does http://s21.postimg.org/jk5ctcwhj/php_highlighting.jpg 可以工作,但也可以突出显示javascript和样式表。我只希望像Notepad ++这样的php代码可以http://s21.postimg.org/jk5ctcwhj/php_highlighting.jpg

Thanks in advance. 提前致谢。

You almost have it. 几乎拥有它。 Instead of your scope being text source , just set it to text source.php and you'll be all set. 与其将范围设为text sourcetext source.php将其设置为text source.php ,就一切text source.php This avoids other languages like source.js , source.css , etc. 这样可以避免使用其他语言,例如source.jssource.css等。

I'm not sure if it works for Sublime Text 2 (I am currently using Sublime Text 3 ), neither if it works as you expect, but it might worth a try (or at least help anyone else interested in something similar): 我不确定它是否适用于Sublime Text 2 (我目前正在使用Sublime Text 3 ),也不能按您的预期工作,但是可能值得一试(或至少可以帮助对类似事物感兴趣的其他人):

Ctrl + Shift + P opens the Tools > Command Palette option. Ctrl + Shift + P打开“ Tools >“ Command Palette选项。

Then, type ssphp and hit enter. 然后,键入ssphp并按Enter。

After these steps, the Set Syntax: PHP action will be applied. 完成这些步骤后,将应用“ Set Syntax: PHP操作。

Note: If you want to set the syntax to something different from php, type ss (to filter for all Set Syntax es actions, and then type the language you want. 注意:如果要将语法设置为不同于php的语法,请键入ss (以筛选所有“ Set Syntax es操作,然后键入所需的语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM