From 2f989c78adc3be7a2751f04f11b6ab07ffbfcf42 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 13 Jul 2018 12:25:06 +0200 Subject: [PATCH] vim: add syntax for /etc/network/interfaces --- vim/vim/syntax/interfaces.vim | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 vim/vim/syntax/interfaces.vim diff --git a/vim/vim/syntax/interfaces.vim b/vim/vim/syntax/interfaces.vim new file mode 100644 index 0000000..f740f7e --- /dev/null +++ b/vim/vim/syntax/interfaces.vim @@ -0,0 +1,42 @@ +" Vim syntax file +" Language: interfaces (/etc/network/interfaces) +" Maintaner: François Wendling +" Version: 0.1 +" Released under the terms of the GNU/GPL licence v2 +" +if version < 600 + syntax clear +endif +setlocal iskeyword+=- + + +syn match interfacesComment /^\s*#.*$/ contains=interfacesComment +syn keyword interfacesOpta address gateway netmask broadcast metric pointopoint media hwadress mtu hostname leasehours leasetime vendor client bootfile server hwaddr provider frame netnum endpoint local ttl network +syn keyword interfacesSpec mapping iface script auto up down pre-up post-down map contained +syn keyword interfacesOptb inet inet6 static dhcp loopback bootp ppp wvdial v4tunnel manual +"verify xxx.xxx.xxx.xxx && xxx.xxx.xxx.xxx/xx +"IP addresses +syn match interfacesIP /\(\d\{1,3}.\)\{3}\d\{1,3}\(\/\d\d\)\?/ contains=interfacesIP +"MAC addresses +syn match interfacesMAC /\(\x\x\:\)\{5}\x\x/ +syn match interfacesIface /iface\s\+\S\+\s/ contains=interfacesSpec +syn match interfacesArgz /\(mapping\|auto\)\+.*/ contains=interfacesSpec +" All related to scripts +syn match interfacesScript /\(script\|pre-up\|up\|post-up\|pre-down\|down\|post-down\)\s\+.*/ contains=interfacesMAC,interfacesIP,interfacesSpec +syn match interfacesMap /map\s.*\s\S\+$/ contains=interfacesSpec,interfacesMAC,interfacesIP + +hi link interfacesComment Comment +hi link interfacesOpta Statement +hi link interfacesSpec Statement +hi link interfacesOptb Type +hi link interfacesIP String +hi link interfacesMAC String +hi link interfacesNames Special +hi link interfacesIface Special +hi link interfacesArgz Special +hi link interfacesScript Define +hi link interfacesMap Special + +let b:current_syntax = "interfaces" + +" vim: ts=8 ft=vim -- 2.45.2