spice.vim 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. " quit when a syntax file was already loaded
  10. if exists("b:current_syntax")
  11. finish
  12. endif
  13. " spice syntax is case INsensitive
  14. syn case ignore
  15. syn keyword spiceTodo contained TODO
  16. syn match spiceComment "^ \=\*.*$" contains=@Spell
  17. syn match spiceComment "\$.*$" contains=@Spell
  18. " Numbers, all with engineering suffixes and optional units
  19. "==========================================================
  20. "floating point number, with dot, optional exponent
  21. syn match spiceNumber "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  22. "floating point number, starting with a dot, optional exponent
  23. syn match spiceNumber "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  24. "integer number with optional exponent
  25. syn match spiceNumber "\<[0-9]\+\(e[-+]\=[0-9]\+\)\=\(meg\=\|[afpnumkg]\)\="
  26. " Misc
  27. "=====
  28. syn match spiceWrapLineOperator "\\$"
  29. syn match spiceWrapLineOperator "^+"
  30. syn match spiceStatement "^ \=\.\I\+"
  31. " Matching pairs of parentheses
  32. "==========================================
  33. syn region spiceParen transparent matchgroup=spiceOperator start="(" end=")" contains=ALLBUT,spiceParenError
  34. syn region spiceSinglequote matchgroup=spiceOperator start=+'+ end=+'+
  35. " Errors
  36. "=======
  37. syn match spiceParenError ")"
  38. " Syncs
  39. " =====
  40. syn sync minlines=50
  41. " Define the default highlighting.
  42. " Only when an item doesn't have highlighting yet
  43. hi def link spiceTodo Todo
  44. hi def link spiceWrapLineOperator spiceOperator
  45. hi def link spiceSinglequote spiceExpr
  46. hi def link spiceExpr Function
  47. hi def link spiceParenError Error
  48. hi def link spiceStatement Statement
  49. hi def link spiceNumber Number
  50. hi def link spiceComment Comment
  51. hi def link spiceOperator Operator
  52. let b:current_syntax = "spice"
  53. " insert the following to $VIM/syntax/scripts.vim
  54. " to autodetect HSpice netlists and text listing output:
  55. "
  56. " " Spice netlists and text listings
  57. " elseif getline(1) =~ 'spice\>' || getline("$") =~ '^\.end'
  58. " so <sfile>:p:h/spice.vim
  59. " vim: ts=8