A Sublime Text 3+ syntax definition for your nftables rules
nftables should now be the regular way of handling Netfilter rules, and I was surprised not to find any syntax definition for Sublime Text.
This project aims to provide a "basic" one, as long as a building procedure for GNU/Linux users (when the nft
binary is available for "dynamic" syntax checks).
This project has been inspired by the official nano syntax definition.
See the Scripting nftables Wiki page for external reference.
- Open your command palette and type in :
Package Control: Install Package
- Browse the list or search for
Nftables
- Press
Enter
and you're done !
Package Control dedicated page here.
- Move into Sublime Text packages folder (usually
$HOME/.config/sublime-text/Packages/
or%AppData%\Sublime Text\Packages\
) - Clone this repository there :
git clone https://github.com/HorlogeSkynet/Nftables.git
- Restart Sublime Text and... 🎉
-
Open your command palette and type in :
Set Syntax: Nftables
-
Click on the bottom-right corner :
Nftables
-
View > Syntax > Nftables
-
Open your command palette and type in :
Build With: Nftables
-
Press
CTRL + B
-
Tools > Build
Formats currently supported
- nftables output
- scripted configuration
No, but feel free to contribute.
Well, sorry to hear that. Grammar wasn't my favorite course at school.
I'd be pleased to review any issue or pull request.
Why didn't you convert the official Bison parser to Sublime's definition syntax ?
It looks like such a tool does not exist (yet ?).
No, but I would advise you this blog post as a well-explained starting point, written by @tasn.
Of course, open the
Nftables.sublime-syntax
file, pressCTRL + Shift + B
and chooseBuild With: Syntax Tests
.