- Mitglied seit
- 25 Jan 2005
- Beiträge
- 33
- Punkte für Reaktionen
- 0
- Punkte
- 0
append to file /usr/share/vim/filetype.vim
create file /usr/share/vim/syntax/asterisk.vim
http://www.voip-info.org/tiki-print.php?page=vim+syntax+highlighting
Code:
" Asterisk config file
au BufNewFile,BufRead *asterisk/*.conf* setf asterisk
Code:
" Vim syntax file
" Language: Asterisk config file
" Maintainer: brc007
" Last Change: 2004 Jun 6
" version 0.1
" 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"
syn match asteriskPriority "\s*,\s*\zs[0-9][0-9]*\ze\s*"
syn match asteriskInclude "^#.*"
syn match asteriskVar "\${[A-Za-z][A-Za-z0-9_]*}"
syn match 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 asteriskPriority Preproc
HiLink asteriskVar Type
HiLink asteriskExp Type
delcommand HiLink
endif
let b:current_syntax = "asterisk"
" vim: ts=8 sw=2
http://www.voip-info.org/tiki-print.php?page=vim+syntax+highlighting