tf.vim 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. " Vim syntax file
  2. " Language: tf
  3. " Maintainer: Lutz Eymers <ixtab@polzin.com>
  4. " URL: http://www.isp.de/data/tf.vim
  5. " Email: send syntax_vim.tgz
  6. " Last Change: 2001 May 10
  7. "
  8. " Options lite_minlines = x to sync at least x lines backwards
  9. " Remove any old syntax stuff hanging around
  10. " quit when a syntax file was already loaded
  11. if exists("b:current_syntax")
  12. finish
  13. endif
  14. syn case match
  15. if !exists("main_syntax")
  16. let main_syntax = 'tf'
  17. endif
  18. " Special global variables
  19. syn keyword tfVar HOME LANG MAIL SHELL TERM TFHELP TFLIBDIR TFLIBRARY TZ contained
  20. syn keyword tfVar background backslash contained
  21. syn keyword tfVar bamf bg_output borg clearfull cleardone clock connect contained
  22. syn keyword tfVar emulation end_color gag gethostbyname gpri hook hilite contained
  23. syn keyword tfVar hiliteattr histsize hpri insert isize istrip kecho contained
  24. syn keyword tfVar kprefix login lp lpquote maildelay matching max_iter contained
  25. syn keyword tfVar max_recur mecho more mprefix oldslash promt_sec contained
  26. syn keyword tfVar prompt_usec proxy_host proxy_port ptime qecho qprefix contained
  27. syn keyword tfVar quite quitdone redef refreshtime scroll shpause snarf sockmload contained
  28. syn keyword tfVar start_color tabsize telopt sub time_format visual contained
  29. syn keyword tfVar watch_dog watchname wordpunct wrap wraplog wrapsize contained
  30. syn keyword tfVar wrapspace contained
  31. " Worldvar
  32. syn keyword tfWorld world_name world_character world_password world_host contained
  33. syn keyword tfWorld world_port world_mfile world_type contained
  34. " Number
  35. syn match tfNumber "-\=\<\d\+\>"
  36. " Float
  37. syn match tfFloat "\(-\=\<\d+\|-\=\)\.\d\+\>"
  38. " Operator
  39. syn match tfOperator "[-+=?:&|!]"
  40. syn match tfOperator "/[^*~@]"he=e-1
  41. syn match tfOperator ":="
  42. syn match tfOperator "[^/%]\*"hs=s+1
  43. syn match tfOperator "$\+[([{]"he=e-1,me=e-1
  44. syn match tfOperator "\^\[\+"he=s+1 contains=tfSpecialCharEsc
  45. " Relational
  46. syn match tfRelation "&&"
  47. syn match tfRelation "||"
  48. syn match tfRelation "[<>/!=]="
  49. syn match tfRelation "[<>]"
  50. syn match tfRelation "[!=]\~"
  51. syn match tfRelation "[=!]/"
  52. " Readonly Var
  53. syn match tfReadonly "[#*]" contained
  54. syn match tfReadonly "\<-\=L\=\d\{-}\>" contained
  55. syn match tfReadonly "\<P\(\d\+\|R\|L\)\>" contained
  56. syn match tfReadonly "\<R\>" contained
  57. " Identifier
  58. syn match tfIdentifier "%\+[a-zA-Z_#*-0-9]\w*" contains=tfVar,tfReadonly
  59. syn match tfIdentifier "%\+[{]"he=e-1,me=e-1
  60. syn match tfIdentifier "\$\+{[a-zA-Z_#*-0-9]\w*}" contains=tfWorld
  61. " Function names
  62. syn keyword tfFunctions ascii char columns echo filename ftime fwrite getopts
  63. syn keyword tfFunctions getpid idle kbdel kbgoto kbhead kblen kbmatch kbpoint
  64. syn keyword tfFunctions kbtail kbwordleft kbwordright keycode lines mod
  65. syn keyword tfFunctions moresize pad rand read regmatch send strcat strchr
  66. syn keyword tfFunctions strcmp strlen strncmp strrchr strrep strstr substr
  67. syn keyword tfFunctions systype time tolower toupper
  68. syn keyword tfStatement addworld bamf beep bind break cat changes connect contained
  69. syn keyword tfStatement dc def dokey echo edit escape eval export expr fg for contained
  70. syn keyword tfStatement gag getfile grab help hilite histsize hook if input contained
  71. syn keyword tfStatement kill lcd let list listsockets listworlds load contained
  72. syn keyword tfStatement localecho log nohilite not partial paste ps purge contained
  73. syn keyword tfStatement purgeworld putfile quit quote recall recordline save contained
  74. syn keyword tfStatement saveworld send sh shift sub substitute contained
  75. syn keyword tfStatement suspend telnet test time toggle trig trigger unbind contained
  76. syn keyword tfStatement undef undefn undeft unhook untrig unworld contained
  77. syn keyword tfStatement version watchdog watchname while world contained
  78. " Hooks
  79. syn keyword tfHook ACTIVITY BACKGROUND BAMF CONFAIL CONFLICT CONNECT DISCONNECT
  80. syn keyword tfHook KILL LOAD LOADFAIL LOG LOGIN MAIL MORE PENDING PENDING
  81. syn keyword tfHook PROCESS PROMPT PROXY REDEF RESIZE RESUME SEND SHADOW SHELL
  82. syn keyword tfHook SIGHUP SIGTERM SIGUSR1 SIGUSR2 WORLD
  83. " Conditional
  84. syn keyword tfConditional if endif then else elseif contained
  85. " Repeat
  86. syn keyword tfRepeat while do done repeat for contained
  87. " Statement
  88. syn keyword tfStatement break quit contained
  89. " Include
  90. syn keyword tfInclude require load save loaded contained
  91. " Define
  92. syn keyword tfDefine bind unbind def undef undefn undefn purge hook unhook trig untrig contained
  93. syn keyword tfDefine set unset setenv contained
  94. " Todo
  95. syn keyword tfTodo TODO Todo todo contained
  96. " SpecialChar
  97. syn match tfSpecialChar "\\[abcfnrtyv\\]" contained
  98. syn match tfSpecialChar "\\\d\{3}" contained contains=tfOctalError
  99. syn match tfSpecialChar "\\x[0-9a-fA-F]\{2}" contained
  100. syn match tfSpecialCharEsc "\[\+" contained
  101. syn match tfOctalError "[89]" contained
  102. " Comment
  103. syn region tfComment start="^;" end="$" contains=tfTodo
  104. " String
  105. syn region tfString oneline matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=tfIdentifier,tfSpecialChar,tfEscape
  106. syn region tfString matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=tfIdentifier,tfSpecialChar,tfEscape
  107. syn match tfParentError "[)}\]]"
  108. " Parents
  109. syn region tfParent matchgroup=Delimiter start="(" end=")" contains=ALLBUT,tfReadonly
  110. syn region tfParent matchgroup=Delimiter start="\[" end="\]" contains=ALL
  111. syn region tfParent matchgroup=Delimiter start="{" end="}" contains=ALL
  112. syn match tfEndCommand "%%\{-};"
  113. syn match tfJoinLines "\\$"
  114. " Types
  115. syn match tfType "/[a-zA-Z_~@][a-zA-Z0-9_]*" contains=tfConditional,tfRepeat,tfStatement,tfInclude,tfDefine,tfStatement
  116. " Catch /quote .. '
  117. syn match tfQuotes "/quote .\{-}'" contains=ALLBUT,tfString
  118. " Catch $(/escape )
  119. syn match tfEscape "(/escape .*)"
  120. " sync
  121. if exists("tf_minlines")
  122. exec "syn sync minlines=" . tf_minlines
  123. else
  124. syn sync minlines=100
  125. endif
  126. " Define the default highlighting.
  127. " Only when an item doesn't have highlighting yet
  128. hi def link tfComment Comment
  129. hi def link tfString String
  130. hi def link tfNumber Number
  131. hi def link tfFloat Float
  132. hi def link tfIdentifier Identifier
  133. hi def link tfVar Identifier
  134. hi def link tfWorld Identifier
  135. hi def link tfReadonly Identifier
  136. hi def link tfHook Identifier
  137. hi def link tfFunctions Function
  138. hi def link tfRepeat Repeat
  139. hi def link tfConditional Conditional
  140. hi def link tfLabel Label
  141. hi def link tfStatement Statement
  142. hi def link tfType Type
  143. hi def link tfInclude Include
  144. hi def link tfDefine Define
  145. hi def link tfSpecialChar SpecialChar
  146. hi def link tfSpecialCharEsc SpecialChar
  147. hi def link tfParentError Error
  148. hi def link tfTodo Todo
  149. hi def link tfEndCommand Delimiter
  150. hi def link tfJoinLines Delimiter
  151. hi def link tfOperator Operator
  152. hi def link tfRelation Operator
  153. let b:current_syntax = "tf"
  154. if main_syntax == 'tf'
  155. unlet main_syntax
  156. endif
  157. " vim: ts=8