G-code syntax highlighting in Sublime Text 3

I’m a big fan of Sublime Text. It’s my favorite editor for programming. And lately I’ve had to do quite a bit of analysis on G-code during the development of post processors for our new machining centers.

There are text editors created with the purpose of editing G code but those softwares are usually old, unmaintained, or lack features you’re accustomed to having with mainstream text editors. Some of the better offerings are developed by CAM vendors but they suffer as well since manufacturing software companies sometimes seem to make things just to put their name on them. I wonder why they don’t write plugins for Sublime Text or Notepad++. Surely, programmers must develop the software at these organizations?

Since regular expressions are one of tools I use often Sublime Text is perfect for me and I’ve been complaining about the fact that I couldn’t find Syntax Highlighting for g code, so I created a Syntax Definition and I’m sharing it on GitHub.

G code syntax highlighting screenshot

Here’s the link:



I’ve also added the package to package control.

If you want to make changes or add features these references will you get you pretty far:

Sublime Text Documentation: Syntax Definitions
Oniguruma Regular Expression Reference (the brand of regular expression used in the defition file)
TextMate Naming Conventions (use these for the name parameter)

Leave a Reply

Your email address will not be published. Required fields are marked *