Tuesday 15 January 2013

sublimetext2 - Sublime text: how to customize syntax highlighting? -


I use Smarty to generate HTML templates. I currently use HTML highlighting, which is mostly okay, except that it does not highlight the smart tag, pre {foreach} I tried to install a smarter package, but it does not look very good. So basically I should be able to highlight anything with the curly bracket for the standard HTML color. Is this possible? How can this be done?

background

@MattDMo is correct that .tmTheme Is the principal file that controls file highlighting. It is an XML file with regular expressions and a series of tags that correspond to what type of syntax to regx.

You can search on GitHub and find many people who have already created a sub-text package containing the .tmTheme files. Note that you can use a package created directly for TextMate, because the subtitle text uses the same conventions. (It is true that at least as .tmTheme and .tmPreferences files are known.)

For example, The syntax was originally able to highlight the package for the ChucK language originally created for TextMate, and it used SublimeText2 to copy the file used with TextMate .tmTheme worked immediately . I just removed extra junk files and then made some changes to .tmTheme , as well as additional support for package manager

view this project here:.

Ways to Install New Syntax

Package Control

Ideally, the syntax you already want Siblam is available for download in text package control. Find in package control and install directly. (If you do not have package control yet, you will need to get it :)

Manually

If you have .tmTheme file or .tmbundle directly, you want to copy it to the appropriate package folder in the scheduled tribe. Note that there is a / package folder and a / package / user folder. The ST2 documentation suggests copying the latter because it is guaranteed to be protected, even if other packages are deleted / modified during the update in the main folder.

On OSX, that directory is: ~ / library / application support / excellent text2 / package / user /

(Note: git clone package you like, so you can easily update it.)

How to make your own

If you dig Want to customize syntax highlighting, so there are some places to get started here.

  • Brush on your regular expressions.
  • & lt; Ctrl> + & Lt; Shift & gt; + P Whenever you are viewing a file, select a word and press this key combination, then in the footer bar, you should see a series of syntax details. For example: I just highlighted a word in the SQL file that I was looking for and the response was: source.sql string.other.quoted.backtick.sql .
  • You probably would like to parse your syntax by using JavaScript / JSON rather than XML. You can get it through package control. It has commands that allow you to go back and forth between JSON (.json) and .teamtheme (XML) files.
  • A.

    Cavatt

    This may be obvious, but the usefulness of syntax highlighting is related to the color scheme selected in the text you select. (Sublime Text2 -> Preferences -> Color Scheme - & gt; ...)

    I do not have the opportunity to explore / verify in detail so far, but it seems Is that some color schemes differ between the more / less types of syntax elements.

    I highly recommend the "Monocai" color scheme (especially the "Monocai Soda" version) for this reason - it seems "Bring the colors out"

No comments:

Post a Comment