Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

87 rader
2.1 KiB

  1. """
  2. """ Experimental Lol Engine Vim plugin
  3. """
  4. """ More info here:
  5. """ http://lolengine.net/wiki/dev/setup/vim
  6. """
  7. """
  8. """ Add syntax highlighting for new C++ types
  9. """
  10. " some custom base types
  11. au Syntax cpp
  12. \ syn keyword cType
  13. \ half ldouble lldouble real uint
  14. " Some custom container types
  15. au Syntax cpp
  16. \ syn keyword cType
  17. \ tuple array array2d array3d hash map
  18. " GLSL types and the Lol Engine extensions
  19. au Syntax cpp
  20. \ syn match cType
  21. \ "\<\(f16\|\|f64\|f128\|r\|[iu]\(8\|16\|\|64\)\)\(vec[234]\|cmplx\|quat\|mat\([234]\|2x3\|3x2\|3x4\|4x3\|2x4\|4x2\)\)\>"
  22. " HLSL types
  23. au Syntax cpp
  24. \ syn match cType
  25. \ "\<\(int\|half\|float\)[234]\(\|x[234]\)\>"
  26. " More GLSL-like types from the Lol Engine
  27. au Syntax cpp
  28. \ syn keyword cType
  29. \ box2 dbox2 ibox2 ubox2
  30. \ box3 dbox3 ibox3 ubox3
  31. " Ensure we know about nullptr
  32. au Syntax cpp
  33. \ syn keyword cConstant
  34. \ nullptr
  35. " New maths constants
  36. au Syntax cpp
  37. \ syn match cConstant
  38. \ "\<\(F\|D\|LD\)_\(PI\|PI_[234]\|[12]_PI\|SQRT_[23]\|SQRT_1_2\)\>"
  39. " Global keywords
  40. au Syntax cpp
  41. \ syn keyword cConstant
  42. \ UNUSED ASSERT
  43. """
  44. """ LolFx language handler
  45. """
  46. " For now, pretend .lolfx is C++
  47. au BufRead,BufNewFile *.lolfx set syntax=cpp
  48. " New sampler types (GLSL)
  49. au BufRead,BufNewFile *.lolfx syn match cType
  50. \ "\<sampler\(\([12]D\|Cube\)\(Array\|\)\(Shadow\|\)\)\>"
  51. \ "\<sampler\(3D\|2DRect\|Buffer\|2DMS\|2DMSArray\|2DRectShadow\)\>"
  52. " Type constructs (LolFx)
  53. au BufRead,BufNewFile *.lolfx syn keyword cppStructure
  54. \ technique pass precision
  55. " Variable attributes (GLSL and some HLSL)
  56. au BufRead,BufNewFile *.lolfx syn keyword cType
  57. \ in out uniform attribute varying
  58. " Texture operators (GLSL and HLSL)
  59. au BufRead,BufNewFile *.lolfx syn keyword cppOperator
  60. \ texture1D texture2D texture3D tex2D tex3D
  61. " Handle #version constructs
  62. au BufRead,BufNewFile *.lolfx syn region cPreProc
  63. \ start="^\s*\(%:\|#\)\s*version\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
  64. " LolFx shader region
  65. au BufRead,BufNewFile *.lolfx syn region cSpecial
  66. \ start="^\s*\[[^\]]*\(glsl\|hlsl\)\]" end="$" contains=ALLBUT,@cPreProcGroup,@Spell