Thursday, December 12, 2019

syntax highlighting for IPv6 in resolv.conf (resolv.vim)

I really don't understand vim syntax highlighting at all. This works, but I wanted to run it by somebody who actually does. I blatantly stole the additional regex from bindzone.vim, but I've no idea what the contains=@reolvIPCluster bit does in the original or whether I broke anything. It _seems_ to work fine. The fact that it went unresolved for several years combined with it only taking a few minutes of discovery to fix is what concerns me. Is there anything wrong with the below snippet (the first and last match are from the shipped resolv.vim)?

...
" Particular
syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{6}\(\x\{1,4}:\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\s\@<=::\(\(\x\{1,4}:\)\{,6}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{1}:\(\(\x\{1,4}:\)\{,5}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{2}:\(\(\x\{1,4}:\)\{,4}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{3}:\(\(\x\{1,4}:\)\{,3}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{4}:\(\(\x\{1,4}:\)\{,2}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{5}:\(\(\x\{1,4}:\)\{,1}\x\{1,4}\)\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{6}:\x\{1,4}\>/
syn match resolvIPNameserver contained /\<\(\x\{1,4}:\)\{1,7}:\(\s\|;\|$\)\@=/
syn match resolvHostnameSearch contained /\%(\%([-0-9A-Za-z_]\+\.\)*[-0-9A-Za-z_]\+\.\?\%(\s\|$\)\)\+/
...

This or similar needs to be added to resolv.vim upstream, but figured I'd post in the user forum for a sanity check first.

Thanks in advance.

--DJ

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8a3d910f-9c18-44e4-baf2-877b38aecc7b%40googlegroups.com.

No comments: