Bug#322850: support for Asterisk configuration files highlighting
(patch included)
Stefano Zacchiroli
zack at bononia.it
Mon Sep 19 19:56:07 UTC 2005
On Mon, Sep 19, 2005 at 10:23:34AM +0200, Bram Moolenaar wrote:
> Setting the filetype should be much lower down in the filetype.vim file,
> because the pattern ends in "*".
Thanks, done in the attached patch (applied in the debian package).
> The syntax file doesn't mention the name of the maintainer. There must
> be a way to contact the maintainer if someone would like to make a
> remark. I prefer the maintainer sending the syntax file to me directly,
> please tell him/her that.
Ok, I will mail him asking to get in touch with you.
Cheers.
--
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-
-------------- next part --------------
diff -urN vim63/runtime/filetype.vim vim63.new/runtime/filetype.vim
--- vim63/runtime/filetype.vim 2005-09-19 21:52:16.000000000 +0200
+++ vim63.new/runtime/filetype.vim 2005-09-19 21:51:43.000000000 +0200
@@ -1722,6 +1722,9 @@
au BufNewFile,BufRead svn-commit.*.tmp setf svn
au BufNewFile,BufRead svn-commit.tmp setf svn
+" Asterisk config file
+au BufNewFile,BufRead *asterisk/*.conf* setf asterisk
+
" X resources file
au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* setf xdefaults
@@ -1740,7 +1743,6 @@
" Z-Shell script
au BufNewFile,BufRead zsh*,zlog* setf zsh
-
" Generic configuration file (check this last, it's just guessing!)
au BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
diff -urN vim63/runtime/syntax/asterisk.vim vim63.new/runtime/syntax/asterisk.vim
--- vim63/runtime/syntax/asterisk.vim 1970-01-01 01:00:00.000000000 +0100
+++ vim63.new/runtime/syntax/asterisk.vim 2005-09-19 21:51:03.000000000 +0200
@@ -0,0 +1,73 @@
+" 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")
+ finish
+endif
+
+"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>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+
+
+ 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
+endif
+
+
+let b:current_syntax = "asterisk"
+
+" vim: ts=8 sw=2
More information about the pkg-vim-maintainers
mailing list