Bug#322850: vim-common: asterisk config highlighting

Santiago José Ruano Rincón santiago at unicauca.edu.co
Sat Aug 13 02:20:19 UTC 2005

Package: vim-common
Version: 1:6.3-071+1
Severity: wishlist


The attached files enable highlighting for the asterisk pbx config
files, they were taken from [1].

[1] http://www.voip-info.org/tiki-index.php?page=vim+syntax+highlighting

Please, add to the vim-common package.

thanks for your work maintaining vim,

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.11
Locale: LANG=es_CO, LC_CTYPE=es_CO (charmap=ISO-8859-1)

Versions of packages vim-common depends on:
ii  vim                          1:6.3-071+1 Vi IMproved - enhanced vi editor

-- no debconf information
-------------- next part --------------

" Vim syntax file
" Language:	Asterisk config file
" Maintainer:	brc007
" Last Change:	2005 Mar 7
" version 0.2
" Additional changes made 2005 Mar 7 by Corydon76
" * CVS priority, including n and s, and new label definitions
" * ENV( and LEN( support
" * Class patterns in extensions now match only the class pattern (instead of to a following expression)
" * anthm's functions are matched
" * Variables now appear in their own colors inside expressions

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")

"testing only
syn sync clear
syn sync fromstart

syn keyword	asteriskTodo	TODO contained
syn match	asteriskComment		";.*" contains=asteriskTodo
syn match       asteriskContext         "\[.\{-}\]"
syn match	asteriskExten		"^\s*exten\s*=>"
syn match       asteriskApp             "\s*,\s*\zs[a-zA-Z]*\ze"
" Digits plus oldlabel (newlabel)
syn match       asteriskPriority        ",[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?,"
" s or n plus digits (newlabel)
syn match       asteriskPriority        ",[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?,"
syn match       asteriskIncludeBad "^\s*#\s*[[:alnum:]]*"
syn match       asteriskInclude		"^\s#\sinclude\s.*"
syn match       asteriskVar             "\${_\{0,2}[[:alpha:]][[:alnum:]_]*\(:[[:digit:]]\+\)\{0,2}}"
syn match       asteriskVarLen          "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.\{-})}" contains=asteriskVar,asteriskVarLen,asteriskExp
syn match       asteriskExp             "\$\[.\{-}\]" contains=asteriskVar,asteriskVarLen,asteriskExp
syn match       asteriskFunc            "\$([[:alpha:]][[:alnum:]_]*.*)" contains=asteriskVar,asteriskVarLen,asteriskExp

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
:if version >= 508 || !exists("did_conf_syntax_inits")
  if version < 508
    let did_conf_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
    command -nargs=+ HiLink hi def link <args>

  HiLink	asteriskComment	Comment
" not sure what type this should be, using String for testing.
  HiLink	asteriskExten	String
" same here
  HiLink	asteriskContext		Identifier 
  HiLink        asteriskApplication     Statement
  HiLink        asteriskInclude		Preproc 
  HiLink        asteriskIncludeBad  Error
  HiLink	asteriskPriority	Preproc	
  HiLink        asteriskVar             String
  HiLink        asteriskVarLen          Function
  HiLink        asteriskExp             Type
 delcommand HiLink

let b:current_syntax = "asterisk" 

" vim: ts=8 sw=2

-------------- next part --------------
--- /usr/share/vim/vim63/filetype.vim	2005-08-12 21:08:04.000000000 -0500
+++ tmp/filetype.vim	2005-08-12 21:08:19.000000000 -0500
@@ -173,6 +173,9 @@
 " Macro (VAX)
 au BufNewFile,BufRead *.mar			setf vmasm
+" Asterisk config file
+au BufNewFile,BufRead *asterisk/*.conf*         setf asterisk 
 " Atlas
 au BufNewFile,BufRead *.atl,*.as		setf atlas

More information about the pkg-vim-maintainers mailing list