asterisk.vim (5629B)
1 " Vim syntax file 2 " Language: Asterisk config file 3 " Maintainer: Jean Aunis <jean.aunis@yahoo.fr> 4 " Previous Maintainer: brc007 5 " Updated for 1.2 by Tilghman Lesher (Corydon76) 6 " Last Change: 2015 Feb 27 7 " version 0.4 8 9 " quit when a syntax file was already loaded 10 if exists("b:current_syntax") 11 finish 12 endif 13 14 syn sync clear 15 syn sync fromstart 16 17 syn keyword asteriskTodo TODO contained 18 syn match asteriskComment ";.*" contains=asteriskTodo 19 syn match asteriskContext "\[.\{-}\]" 20 syn match asteriskExten "^\s*\zsexten\s*=>\?\s*[^,]\+\ze," contains=asteriskPattern nextgroup=asteriskPriority 21 syn match asteriskExten "^\s*\zssame\s*=>\?\s*\ze" nextgroup=asteriskPriority 22 syn match asteriskExten "^\s*\(register\|channel\|ignorepat\|include\|l\?e\?switch\|\(no\)\?load\)\s*=>\?" 23 syn match asteriskPattern "_\(\[[[:alnum:]#*\-]\+\]\|[[:alnum:]#*]\)*\.\?" contained 24 syn match asteriskPattern "[^A-Za-z0-9,]\zs[[:alnum:]#*]\+\ze" contained 25 syn match asteriskApp ",\zs[a-zA-Z]\+\ze$" 26 syn match asteriskApp ",\zs[a-zA-Z]\+\ze(" 27 " Digits plus oldlabel (newlabel) 28 syn match asteriskPriority "\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel 29 " oldlabel plus digits (newlabel) 30 syn match asteriskPriority "\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel 31 " s or n plus digits (newlabel) 32 syn match asteriskPriority "\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel 33 syn match asteriskLabel "(\zs[[:alpha:]][[:alnum:]]*\ze)" contained 34 syn match asteriskError "^\s*#\s*[[:alnum:]]*" 35 syn match asteriskInclude "^\s*#\s*\(include\|exec\)\s.*" 36 syn match asteriskVar "\${_\{0,2}[[:alpha:]][[:alnum:]_]*\(:-\?[[:digit:]]\+\(:[[:digit:]]\+\)\?\)\?}" 37 syn match asteriskVar "_\{0,2}[[:alpha:]][[:alnum:]_]*\ze=" 38 syn match asteriskVarLen "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.*)}" contains=asteriskVar,asteriskVarLen,asteriskExp 39 syn match asteriskVarLen "(\zs[[:alpha:]][[:alnum:]_]*(.\{-})\ze=" contains=asteriskVar,asteriskVarLen,asteriskExp 40 syn match asteriskExp "\$\[.\{-}\]" contains=asteriskVar,asteriskVarLen,asteriskExp 41 syn match asteriskCodecsPermit "^\s*\(allow\|disallow\)\s*=\s*.*$" contains=asteriskCodecs 42 syn match asteriskCodecs "\(vp9\|vp8\|h264\|h263p\|h263\|h261\|jpeg\|opus\|g722\|g723\|gsm\|ulaw\|alaw\|g719\|g726\|g726aal2\|siren7\|siren14\|adpcm\|slin\|lpc10\|g729\|speex\|ilbc\|wav\|all\s*$\)" 43 syn match asteriskError "^\(type\|auth\|permit\|deny\|bindaddr\|host\)\s*=.*$" 44 syn match asteriskType "^\zstype=\ze\<\(peer\|user\|friend\)\>$" contains=asteriskTypeType 45 syn match asteriskTypeType "\<\(peer\|user\|friend\)\>" contained 46 syn match asteriskAuth "^\zsauth\s*=\ze\s*\<\(md5\|rsa\|plaintext\)\>$" contains=asteriskAuthType 47 syn match asteriskAuthType "\<\(md5\|rsa\|plaintext\)\>" 48 syn match asteriskAuth "^\zs\(secret\|inkeys\|outkey\)\s*=\ze.*$" 49 syn match asteriskAuth "^\(permit\|deny\)\s*=\s*\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\s*$" contains=asteriskIPRange 50 syn match asteriskIPRange "\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}" contained 51 syn match asteriskIP "\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}" contained 52 syn match asteriskHostname "[[:alnum:]][[:alnum:]\-\.]*\.[[:alpha:]]{2,10}" contained 53 syn match asteriskPort "\d\{1,5}" contained 54 syn match asteriskSetting "^bindaddr\s*=\s*\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}$" contains=asteriskIP 55 syn match asteriskSetting "^port\s*=\s*\d\{1,5}\s*$" contains=asteriskPort 56 syn match asteriskSetting "^host\s*=\s*\(dynamic\|\(\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)\|\([[:alnum:]][[:alnum:]\-\.]*\.[[:alpha:]]{2,10}\)\)" contains=asteriskIP,asteriskHostname 57 58 " Define the default highlighting. 59 " Only when an item doesn't have highlighting yet 60 61 hi def link asteriskComment Comment 62 hi def link asteriskExten String 63 hi def link asteriskContext Preproc 64 hi def link asteriskPattern Type 65 hi def link asteriskApp Statement 66 hi def link asteriskInclude Preproc 67 hi def link asteriskIncludeBad Error 68 hi def link asteriskPriority Preproc 69 hi def link asteriskLabel Type 70 hi def link asteriskVar String 71 hi def link asteriskVarLen Function 72 hi def link asteriskExp Type 73 hi def link asteriskCodecsPermit Preproc 74 hi def link asteriskCodecs String 75 hi def link asteriskType Statement 76 hi def link asteriskTypeType Type 77 hi def link asteriskAuth String 78 hi def link asteriskAuthType Type 79 hi def link asteriskIPRange Identifier 80 hi def link asteriskIP Identifier 81 hi def link asteriskPort Identifier 82 hi def link asteriskHostname Identifier 83 hi def link asteriskSetting Statement 84 hi def link asteriskError Error 85 86 let b:current_syntax = "asterisk" 87 " vim: ts=8 sw=2