Sublime Forum

Custom Syntax highlighting - PF

#1

Hi everyone,

I am evaluating Sublime for use at work to edit OpenBSD/FreePBSD ‘PF’ and ‘Snort’ files (‘pf’ being the important one).

So far its great, but their is no syntax support in Sublime for ‘PF’ which is a deal breaker for us.
It should look like this; sentia.org/downloads/pf.conf.html

Their is syntax support for ‘PF’ in ‘VIM’. Is it possible to somehow get the ‘pf’ syntax support (as per vim.org/scripts/script.php?script_id=341) loaded into Sublime?

If we could get this working we would be able to pay for sublime and roll it out to quite a few members of staff :smile:

Thanks for your time and help, Andy.

0 Likes

#2

Hey,

I’ve had this problem as well regarding Boo syntax highlighting and had to resort to writing my own syntax highlighting.
For a reference, you can find it at https://github.com/Shammah/boo-sublime.

Now your script syntax looks doable with a few regexes.

To start, I’d recommend reading the guides at
http://sublimetext.info/docs/en/extensibility/syntaxdefs.html
http://docs.sublimetext.info/en/latest/reference/syntaxdefs.html

Basically, you create your regexes in JSON format and convert it to the format supported by Sublime Text.
Sublime’s system is based on TextMate’s system, which you can find a reference at http://manual.macromates.com/en/language_grammars

It might be a bit tedious at first, but once you get it working it’s all worth it in my opinion.
I wish you best of luck!

PS: If you ever get it working, you might contribute your syntax file / package to the Package Control library, so everybody else who might need such plugin can enjoy it as well :smile: .

0 Likes