Yamaban wrote:
On Thu, 19 Mar 2015 11:14, Per Jessen <per@...> wrote:
In my copious spare time I was playing with updating the syntax highlighting for /etc/resolv.conf:
/usr/share/vim/current/syntax/resolv.vim
In my own .vim/after/syntax/resolv.vim I have added:
syn match resolvIPNameserver contained /\%([0-9A-Fa-f:.]\+\)\s*$/ contains=@resolvIPCluster
syn cluster resolvIPCluster contains=@resolvIPv4,@resolvIPv6
syn cluster resolvIPv4 contains=resolvIPError,resolvIPSpecial
syn match resolvIPv6 /\([0-9A-Fa-f]{0,4}:\)\{1,7}[0-9A-Fa-f]{1,4}$/ contained
The IPv6 check is at best rudimentary, but I can't quite make it work. If you copy the above and edit /etc/resolv.conf via vi/m, you'll see what I mean.
Well, I'm no guru at vim even if I use it since more than 2 decades.
But, in the resolvIPv6 line one thing springs fore: The END.
I'd change: "{1,4}$/" to "{1,4}\(\s\|$\)/" or even end with just "{1,4}/".
Okay, I'll just end it with "{1,4}/".
On IPv6 address matching, look at /usr/share/vim/current/syntax/pf.vim: syn match pfIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/ syn match pfIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/
Thanks, I should have looked for that myself.
/usr/share/vim/current/syntax/bindzone.vim: multiple lines with "syn match *zoneIP6Addr"
Sorry, limited knowledge here.
Hehe, same here, thanks for chipping in! Did you try loading up my rules and edit /etc/resolv.conf? With a sample /etc/resolv.conf containing this: search local.net nameserver 111.222.111.222 nameserver 2001:db8:2010:1ff::f:1 I see '2001' and '2010' being highlighted, background red, foreground white. If I change to e.g. '200a' and '201a', I get normal highlighting. -- Per Jessen, Zürich (15.4°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org