The syntax file annotates the code and provides scopes to the text in your source code. These scopes can then be used by Sublime Text to highlight your code according to a color scheme. And other plugins can also use these scopes for other functionality, such as autocomplete suggestions, hinting, etc.
I included a color scheme for the specific scopes used in the syntax file. You can use it as-is, or copy the content to your current color scheme (see below) and adjust it.
- Color highlighting:
- Header statements (see Notes)
- Meta commands (see Notes)
- Comments
- Line commands
- Deprecated, invalid and/or unpreferred code
- Impove readability:
- Coloring
x
,y
andz
coordinates in RGB - Marking every odd vertex' background to differentiate them
- Coloring
- Faster and better review and optimization of your code
Download the two source files from this Github.
-
Copy
LDraw.sublime-syntax
into you Sublime Text 3Packages\User
folder and restart your application.If you can't find it, click
Preferences
->Browse Packages
inside Sublime Text 3. This should open the right folder where you'll find theUser
folder.For Windows, it's under:
C:\Users\[your username]\AppData\Roaming\Sublime Text 3\Packages\User
-
Open a
.LDR
,.DAT
or.MPD
file and it should highlight straight away!If not, click
View
->Syntax
->LDraw
or click onPlain text
in the bottom right corner and selectLDraw
If you start a new file with0
, it will auto-detect that you're starting a LDraw file and switch to the right syntax
Although most highlighting should probably work fine in your current theme and color scheme, for full functionality you need to set up the colors for some specific text scopes.
- Open
Material-Theme.sublime-color-scheme
in Sublime Text 3. - Click
Tools
->Packages
->Package Development
->Edit Current Color Scheme
Note: You might need Sublime's PackageDev package installed for this.
- Copy and paste/merge the
variables
andrules
from the source file to the now opened current color scheme file. - (Optional) Adjust colors and styles as you wish.
- Save the current color scheme file in your
Packages\User
folder.
- This is just a start and does not contain all official file specification restrictions, etc.
- Only some of the header statements and meta commands are supported at the moment.
- Feel free to send suggestions, open issues, improve the code and send in pull requests!
- The color scheme is based on Mattia Astorino's Material Theme.
- The rest is made by Philip van Heemstra
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman