Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

vimlol.vim 2.3 KiB

12 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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\([23456789]\|1[012]\)\|cmplx\|quat\|dualquat\|sqt\|mat\([234]\|2x3\|3x2\|3x4\|4x3\|2x4\|4x2\)\)\>"
  22. " HLSL types and the Lol Engine extensions
  23. au Syntax cpp
  24. \ syn match cType
  25. \ "\<\(int\|half\|float\)\([23456789]\|1[012]\|[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. " Unit testing
  40. au Syntax cpp
  41. \ syn match cOperator
  42. \ "\<lolunit_\(fail\|assert\|refute\)[a-z_]*\>"
  43. " Global keywords
  44. au Syntax cpp
  45. \ syn keyword cConstant
  46. \ UNUSED ASSERT
  47. """
  48. """ LolFx language handler
  49. """
  50. " For now, pretend .lolfx is C++
  51. au BufRead,BufNewFile *.lolfx set syntax=cpp
  52. " New sampler types (GLSL)
  53. au BufRead,BufNewFile *.lolfx syn match cType
  54. \ "\<sampler\(\([12]D\|Cube\)\(Array\|\)\(Shadow\|\)\)\>"
  55. \ "\<sampler\(3D\|2DRect\|Buffer\|2DMS\|2DMSArray\|2DRectShadow\)\>"
  56. " Type constructs (LolFx)
  57. au BufRead,BufNewFile *.lolfx syn keyword cppStructure
  58. \ technique pass precision
  59. " Variable attributes (GLSL and some HLSL)
  60. au BufRead,BufNewFile *.lolfx syn keyword cType
  61. \ in out uniform attribute varying
  62. " Texture operators (GLSL and HLSL)
  63. au BufRead,BufNewFile *.lolfx syn keyword cppOperator
  64. \ texture1D texture2D texture3D tex2D tex3D
  65. " Handle #version constructs
  66. au BufRead,BufNewFile *.lolfx syn region cPreProc
  67. \ start="^\s*\(%:\|#\)\s*version\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
  68. " LolFx shader region
  69. au BufRead,BufNewFile *.lolfx syn region cSpecial
  70. \ start="^\s*\[[^\]]*\(glsl\|hlsl\)\]" end="$" contains=ALLBUT,@cPreProcGroup,@Spell