egberts / vim-syntax-bind-named

Vim/NeoVIM syntax for ISC Bind named.conf configuration file.
MIT License
22 stars 5 forks source link
bind bind9 bind9-configuration isc-bind-server named neovim neovim-conf neovim-config neovim-configuration neovim-plugin neovim-plugins vim vim-plugin vim-syntax vim8-plugin vim9-plugin

vim-syntax-bind-named

Highlights your Bind9 named.conf (and zones and its include files) in vim editor session.

Uses 4-bit (16-color) Vim color scheme. Supports light/dark theme too.

To quickly see nearly all permutation of Bind9 named.conf configuration settings , run:

vim test/example-9.16-named.conf

This is where most of my animated GIF came from.

This project aims to replace the stock Vim syntax highlighting for ISC Bind (named.vim), by updating it to recognize the new RRs that came out in the last few decade and also to highlight more clauses/statements/keywords that ISC Bind9 has incorporated as of late.

Example

As comment lines throughout this bind-named.vim syntax file, I incorporate nearly all the revised psuedo-BNF syntax for every named.conf statement keywords encountered. These psuedo-BNF syntax may (often) not match the official ISC Bind documentation because its C source code takes final precedence here.

FEATURES

October 16, 2021

Original release

Filetype Constraints/Expansion

The rndc.conf is now supported (along with its filename variants, as long as as the filename portion begins with rndcX or ends with Xrndc and the letter X signifies a period, an underscore, or a dash/minus symbol.

There's a namedXXXXX.conf out there being used by a database so I figured we constrained it a bit with a dash, an underscore, or a period symbol.

In my huge internal whitelab bastion server, I run two separate named daemon and its configuration files, they all get included into their respective named-XXXX.conf:

/etc/bind/named-public.conf
/etc/bind/public/acl-named.conf
/etc/bind/public/channels-named.conf
/etc/bind/public/controls-named.conf
/etc/bind/public/dnssec-keys-named.conf
/etc/bind/public/masters-named.conf
/etc/bind/public/options-named.conf
/etc/bind/public/servers-named.conf
/etc/bind/public/statistics-named.conf
/etc/bind/public/view.red
/etc/bind/rndc-public.conf

/etc/bind/named-internal.conf
/etc/bind/internal/options-named.conf
/etc/bind/internal/acl-named.conf
/etc/bind/internal/channels-named.conf
/etc/bind/internal/controls-named.conf
/etc/bind/internal/masters-named.conf
/etc/bind/internal/view.red
/etc/bind/internal/view.dmz
/etc/bind/internal/view.yellow
/etc/bind/internal/view.green
/etc/bind/rndc-internal.conf

Array-Type ACL Names

Imagine my surprise in the current Bind version that ACL names can support some form of Python/C/C++ language array naming convention.

Yeah, ACL names like:

acl my_firewall[red][zoom] { acl_conference_rooms; };
acl my_firewall[red][facetime] { acl_conference_rooms; };
acl my_firewall[red][signal] { acl_conference_rooms; };

Pretty cool, uh?

IPv6 Patterns Supported

The following patterns for IPv6 addresses are supported:

PLANS

I plan to:

I maintain those lifetime of keywords for named.conf and its many characteristics into my Pythonized ISC Bind keyword dictionary maintained over at egberts' repo at Github.
Some Python database characteristics for each keywords are:

Bug Reporting

If you have any issues with this syntax file, see if you can:

Debugging Vim Syntax

If you are bold enough to try your hand on debugging Vim syntax file, see my DEBUG.md on how to debug a Vim syntax file.

Install

See INSTALL.md on how to install this Vim syntax to your local Vim settings.

To Vim Developers

Note to Vim developers: During the prototyping of my IPv6 address syntax matching, I noticed that vim 8.1 can only support a maximum of 9 groupings of parenthesis, even if I used the "\%( ... )" notation (instead of "( ...)").

As a result of this Vim limitation, I've had to duplicate IPv6 match patterns through this syntax file to get around this vim 8.1 limitation. But it works and faster so.