On Thu, 19 Mar 2015 15:12, Per Jessen wrote:
Yamaban wrote:
On Thu, 19 Mar 2015 14:32, Per Jessen wrote:
Yamaban wrote:
On Thu, 19 Mar 2015 11:14, Per Jessen 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.
Oh!! Look at the match once again:
syn match resolvIPv6 /\([0-9A-Fa-f]{0,4}:\)\{1,7}[0-9A-Fa-f]{1,4}/ contained
now: just WHAT follows the first grouping? ":\)\{1,7}", see the backslash "\" before the count "{1,7}" ? That is NOT what you want. Correct would be: ":\){1,7}", or as complete line:
syn match resolvIPv6 /\([0-9A-Fa-f]{0,4}:\){1,7}[0-9A-Fa-f]{1,4}/ contained
Right, well spotted! I'm surprised the regex compiler didn't catch it. Anyway, with that I still get the weird highlighting as described above. I also tried with the pfIPv6 patterns, same behaviour.
Did some testing, found you ran afoul the "resolvIPError", any number between 1 and 255 is OK, but above that you get the error marking. In '201a' the "number" is 201, but in '2010' the number is 2010. Either you change resolvIPError only to work if no ":" is on the pattern or you change it to only work if there are dots (protected!) '\.' in the pattern. - Yamaban -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org