为 JS 修改 Sublime Text 2 [英] Modifying Sublime Text 2 for JS

查看:27
本文介绍了为 JS 修改 Sublime Text 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎是Mathematica"之外编程的初学者.

I am almost a beginner to programming outside "Mathematica".

我使用 Sublime Text 2 并且主要需要在 JS 中编码,并且我想使用与首选项中已经存在的颜色主题不同的颜色主题.

I use Sublime Text 2 and mostly need to code in JS, and I would like to use a different color theme than the one already present in preferences.

例如,我想使用这个主题

我尝试安装 Eclipse 尚未成功,我使用的是装有最新版本 Lion 的 Mac.

My attempt installing Eclipse have yet failed, I am using a mac with the latest version of Lion.

推荐答案

大多数主题都支持 JavaScript 语法高亮.如果它没有自动出现,可能是因为 SublimeText 没有将文件识别为包含 JavaScript.您可以通过转到查看">语法">JavaScript">JavaScript"来强制使用它.

Most themes have support for JavaScript syntax highlighting. If it does not appear automatically, it may be because SublimeText does not recognize the file as containing JavaScript. You can force it by going to View > Syntax > JavaScript > JavaScript.

如果您需要定义特定的语法,则必须构建您自己的语法定义.该指南有一个分步过程.

If you need to define a particular syntax, you will have to build your own syntax definition. That guide has a step-by-step process.

如果您需要添加或更改一些定义,我建议您复制现有的 JavaScript 语法定义并进一步完善它.语法定义由正则表达式定义,并保存在 XML 文件中.如果您的变量可以通过特定的正则表达式进行区分,您将能够使用单独的规则对它们进行颜色编码.

I would suggest copying the existing JavaScript syntax definition and refining it further, if you need to add or change a few definitions. The syntax definitions are defined by regular expressions, and held within an XML file. If your variables can be differentiated by a specific regular expression, you will be able to color-code them with a separate rule.

Sublime Text 2:diff 语法高亮浅色背景配色方案提供了更新主题以显示新语法的不同颜色的简洁示例.

Sublime Text 2: diff syntax highlighting with a light background color scheme gives a succinct example of updating a theme to show different colors for new syntax.

这篇关于为 JS 修改 Sublime Text 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆