Skip to content
Scott Kuroda edited this page Sep 7, 2013 · 3 revisions

Create Syntax Definition

  1. Install PlistJsonConverter
  2. Create a new file with the following content
{
    "name": "Syntax Name",
    "scopeName": "source.syntax_name",
    "fileTypes": [""],
    "patterns": [],
    "uuid": ""
}
  • name - Syntax name used for identification
  • scopeName - Scope to be applied to the entire view .
    • Generally something like source.java. However, if not source code, may use something like text.plain
  • fileTypes - Files or extensions used to automatically apply this syntax.
    • Generally something like *.java
  • patters - Patterns to apply scopes to. This effects syntax highlighting.
  • uuid - Identifier for the syntax file. Can be generated in the ST console using the following commands.
import uuid
uuid.uuid4()

Configuration

ST configuration is managed through JSON files. If you are unfamiliar with JSON and plan to use ST, it is worthwhile to obtain a level of understanding of JSON. When there is malformed JSON, ST may fail to load. However, it will likely prompt with the offending file. Be sure this file has valid syntax. If there are problems restarting ST after fixing the error, be sure the process has actually terminated. A bug in ST causes it to remain running, even after a failure occurs.

Packages location

  • OS X: ~/Library/Application Support/Sublime Text 2/Packages/
  • Windows: %APPDATA%/Sublime Text 2/Packages/
  • Linux: ~/.config/sublime-text-2/Packages/

or

  • OS X: ~/Library/Application Support/Sublime Text 3/Packages/
  • Windows: %APPDATA%/Sublime Text 3/Packages/
  • Linux: ~/.config/sublime-text-3/Packages/

Note in ST3, packages can be run directly from *.sublime-package files. These are renamed zips. It is possible to override specific files in *.sublime-package by creating a folder with the appropriate name in the Packages folder. Ensure the file you create has the same name as the file you are trying to override. To make this easier, you may also use PackageResourceViewer.

SO Answers

Find in Files Jump With Keyboard

http://stackoverflow.com/questions/16767732/sublime-text-2-how-to-jump-to-file-from-find-results-using-keyboard/16779397#16779397

Add entries to Symbol List

http://stackoverflow.com/questions/16144443/sublime-text-adding-symbols-to-a-new-language-definition-syntax-highlighting/16153170#16153170

Embedded Syntax

http://stackoverflow.com/questions/15436858/sublime-text-2-different-language-highlighting-based-on-context-a-la-webstorm/15441612#15441612

Expand Environment Variables

http://stackoverflow.com/questions/15999075/use-windows-environment-variables-in-sublime-text-settings-files/16408331#16408331

Open default file/scratch space

http://stackoverflow.com/questions/18637732/is-there-any-way-that-i-can-set-sublime-text-2-to-always-open-a-particular-file/18647042#18647042