1" Vim syntax file 2" Language: Spice circuit simulator input netlist 3" Maintainer: Noam Halevy <Noam.Halevy.motorola.com> 4" Last Change: 2012 Jun 01 5" (Dominique Pelle added @Spell) 6" 7" This is based on sh.vim by Lennart Schultz 8" but greatly simplified 9 10" quit when a syntax file was already loaded 11if exists("b:current_syntax") 12 finish 13endif 14 15" spice syntax is case INsensitive 16syn case ignore 17 18syn keyword spiceTodo contained TODO 19 20syn match spiceComment "^ \=\*.*$" contains=@Spell 21syn match spiceComment "\$.*$" contains=@Spell 22 23" Numbers, all with engineering suffixes and optional units 24"========================================================== 25"floating point number, with dot, optional exponent 26syn match spiceNumber "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\=" 27"floating point number, starting with a dot, optional exponent 28syn match spiceNumber "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\=" 29"integer number with optional exponent 30syn match spiceNumber "\<[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\=" 31 32" Misc 33"===== 34syn match spiceWrapLineOperator "\\$" 35syn match spiceWrapLineOperator "^+" 36 37syn match spiceStatement "^ \=\.\I\+" 38 39" Matching pairs of parentheses 40"========================================== 41syn region spiceParen transparent matchgroup=spiceOperator start="(" end=")" contains=ALLBUT,spiceParenError 42syn region spiceSinglequote matchgroup=spiceOperator start=+'+ end=+'+ 43 44" Errors 45"======= 46syn match spiceParenError ")" 47 48" Syncs 49" ===== 50syn sync minlines=50 51 52" Define the default highlighting. 53" Only when an item doesn't have highlighting yet 54command -nargs=+ HiLink hi def link <args> 55 56HiLink spiceTodo Todo 57HiLink spiceWrapLineOperator spiceOperator 58HiLink spiceSinglequote spiceExpr 59HiLink spiceExpr Function 60HiLink spiceParenError Error 61HiLink spiceStatement Statement 62HiLink spiceNumber Number 63HiLink spiceComment Comment 64HiLink spiceOperator Operator 65 66delcommand HiLink 67 68let b:current_syntax = "spice" 69 70" insert the following to $VIM/syntax/scripts.vim 71" to autodetect HSpice netlists and text listing output: 72" 73" " Spice netlists and text listings 74" elseif getline(1) =~ 'spice\>' || getline("$") =~ '^\.end' 75" so <sfile>:p:h/spice.vim 76 77" vim: ts=8 78