├── ftdetect └── tt.vim ├── README.md └── syntax └── tt.vim /ftdetect/tt.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.tt,*.tin set ft=tt 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A bit more intelligent syntax highlighting for tintin++ scripts (http://tintin.sourceforge.net/index.php). 2 | It should only highlight syntax elements when they are in a context that give them special meaning. 3 | 4 | Some commands are not fully supported, notably #map and #chat. 5 | -------------------------------------------------------------------------------- /syntax/tt.vim: -------------------------------------------------------------------------------- 1 | " VIM Syntax file for tintin++ scripts 2 | " TODO 3 | " Add proper support for #chat 4 | " Add proper support for #map 5 | " Finish support for #buffer get 6 | " Make Better use of Clusters 7 | " Porper #script support, I feel none is better than the fragile support from 8 | " before 9 | " Test vs various code styles 10 | " Add bad syntax highlights to ttError 11 | 12 | if version < 600 13 | syntax clear 14 | elseif exists("b:current_syntax") 15 | finish 16 | endif 17 | 18 | " Sets the '#' character as a valid keyword character 19 | setlocal iskeyword+=# 20 | " tintin++ keywords are case insensitive 21 | syntax case ignore 22 | " tintin++ Commands {{{ 23 | " Kill: #kill #killall {{{ 24 | syntax keyword ttCmd #kill 25 | \ nextgroup=ttListNameKill 26 | \ skipwhite skipempty 27 | 28 | syntax keyword ttCmd #killall 29 | \ nextgroup=ttListName 30 | \ skipwhite skipempty 31 | " }}} 32 | " Debugging: #ignore #debug #message {{{ 33 | syntax keyword ttCmdDebug #ignore #debug #message 34 | \ nextgroup=ttListName,ttListNameBlock 35 | \ skipwhite skipempty 36 | " }}} 37 | " Useless For Scripting: #grep #help #greeting #info {{{ 38 | syntax keyword ttCmdUseless #grep #help #greeting #info 39 | " }}} 40 | " Misc tintin commands: #cr #bell #send #split #system #config #pathdir {{{ 41 | syntax keyword ttCmd #cr #bell 42 | 43 | syntax keyword ttCmd #send 44 | \ nextgroup=ttValueBlock 45 | \ skipwhite skipempty 46 | 47 | syntax keyword ttCmd #split 48 | \ nextgroup=ttSplitValueBlock 49 | \ skipwhite skipempty 50 | 51 | syntax keyword ttCmd #system 52 | \ nextgroup=ttShellCmd 53 | \ skipwhite skipempty 54 | 55 | syntax keyword ttCmd #config 56 | \ nextgroup=ttConfigBlock 57 | \ skipwhite skipempty 58 | 59 | syntax keyword ttCmd #pathdir #unpathdir 60 | " }}} 61 | " End/Suspend: #end #suspend #zap {{{ 62 | syntax keyword ttCmd #end #suspend 63 | 64 | syntax keyword ttCmd #zap 65 | \ nextgroup=ttSessionName,ttSessionNameBlock 66 | \ skipwhite skipempty 67 | " }}} 68 | " Session Related: #all #gts #snoop #session #run {{{ 69 | syntax keyword ttCmd #all #gts 70 | syntax match ttCmd "\c#{gts}" 71 | 72 | syntax keyword ttCmd #snoop 73 | \ nextgroup=ttSessionName,ttSessionNameBlock 74 | \ skipwhite skipempty 75 | 76 | syntax keyword ttCmd #ses[sion] 77 | \ nextgroup=ttSesSessionNameBlock,ttSesSessionName 78 | \ skipwhite skipempty 79 | 80 | syntax keyword ttCmd #run 81 | \ nextgroup=ttRunSessionNameBlock,ttRunSessionName 82 | \ skipwhite skipempty 83 | " }}} 84 | " Looping Commands #while #loop #forall #foreach #parse #break #continue {{{ 85 | syntax keyword ttCmdLoop #break #continue 86 | 87 | syntax keyword ttCmdLoop #while 88 | \ nextgroup=ttExpressionBlock 89 | \ skipwhite skipempty 90 | 91 | syntax keyword ttCmdLoop #forall 92 | \ nextgroup=ttForAllBlock 93 | \ skipwhite skipempty 94 | 95 | syntax keyword ttCmdLoop #foreach 96 | \ nextgroup=ttForEachBlock 97 | \ skipwhite skipempty 98 | 99 | syntax keyword ttCmdLoop #loop 100 | \ nextgroup=ttLoopLowerBlock 101 | \ skipwhite skipempty 102 | 103 | syntax keyword ttCmdLoop #parse 104 | \ nextgroup=ttParseValueBlock 105 | \ skipwhite skipempty 106 | " }}} 107 | " Triggers On Game Output #act #high #sub #event {{{ 108 | syntax keyword ttCmdTrigger #act[ion] #gag 109 | \ nextgroup=ttPatternBlock 110 | \ skipwhite skipempty 111 | 112 | syntax keyword ttCmdTrigger #high[light] 113 | \ nextgroup=ttPatternBlockHigh 114 | \ skipwhite skipempty 115 | 116 | syntax keyword ttCmdTrigger #sub[stitute] #prompt 117 | \ nextgroup=ttPatternBlockSub 118 | \ skipwhite skipempty 119 | 120 | syntax keyword ttCmdTrigger #event 121 | \ nextgroup=ttEventBlock 122 | \ skipwhite skipempty 123 | " }}} 124 | " Input Related: #alias #tab #macro #history #cursor #buffer {{{ 125 | syntax keyword ttCmdInput #alias 126 | \ nextgroup=ttPatternBlock 127 | \ skipwhite skipempty 128 | 129 | syntax keyword ttCmdInput #tab 130 | \ nextgroup=ttValueBlock 131 | \ skipwhite skipempty 132 | 133 | syntax keyword ttCmdInput #macro 134 | \ nextgroup=ttKeyBlock 135 | \ skipwhite skipempty 136 | 137 | syntax keyword ttCmdInput #hist[ory] 138 | \ nextgroup=ttHistSub 139 | \ skipwhite skipempty 140 | 141 | syntax keyword ttCmdInput #cursor 142 | \ nextgroup=ttCursorBlock 143 | \ skipwhite skipempty 144 | 145 | syntax keyword ttCmdInput #buffer 146 | \ nextgroup=ttBufferSub 147 | \ skipwhite skipempty 148 | " }}} 149 | " Switch/Case: #switch #case #default {{{ 150 | syntax keyword ttCmdSwitch #switch #case 151 | \ nextgroup=ttExpressionBlock 152 | \ skipwhite skipempty 153 | 154 | syntax keyword ttCmdSwitch #default 155 | "}}} 156 | " If/ElseIf/Else Branching: #if #elseif #else {{{ 157 | syntax keyword ttCmdBranch #if #elseif 158 | \ nextgroup=ttExpressionBlock 159 | \ skipwhite skipempty 160 | 161 | syntax keyword ttCmdBranch #else 162 | " }}} 163 | " File Related: #read #write #scan #textin {{{ 164 | syntax keyword ttCmd #read #write #scan #textin 165 | \ nextgroup=ttFileNameBlock,ttFileName 166 | \ skipwhite skipempty 167 | " }}} 168 | " Variable Assignment: #var #format #math #regex #repalce #list {{{ 169 | syntax keyword ttCmdVar #var[iable] 170 | \ nextgroup=ttVarVarBlock,ttVarVar 171 | \ skipwhite skipempty 172 | 173 | syntax keyword ttCmdVar #loc[al] 174 | \ nextgroup=ttVarVarBlock,ttVarVar 175 | \ skipwhite skipempty 176 | 177 | syntax keyword ttCmdVar #format 178 | \ nextgroup=ttFormatVarBlock,ttFormatVar 179 | \ skipwhite skipempty 180 | 181 | syntax keyword ttCmdVar #math 182 | \ nextgroup=ttMathVarBlock,ttMathVar 183 | \ skipwhite skipempty 184 | 185 | syntax keyword ttCmdVar #regex 186 | \ nextgroup=ttRegexVarBlock,ttRegexVar 187 | \ skipwhite skipempty 188 | 189 | syntax keyword ttCmdVar #replace 190 | \ nextgroup=ttReplaceVarBlock,ttReplaceVar 191 | \ skipwhite skipempty 192 | 193 | syntax keyword ttCmdVar #list 194 | \ nextgroup=ttListVarBlock,ttListVar 195 | \ skipwhite skipempty 196 | " }}} 197 | " Functions: #function #return {{{ 198 | syntax keyword ttCmd #func[tion] 199 | \ nextgroup=ttFunctionNameBlock 200 | \ skipwhite skipempty 201 | 202 | syntax keyword ttCmd #return 203 | \ nextgroup=ttValueBlock 204 | \ skipwhite skipempty 205 | " }}} 206 | " Time Realted: #tick #delay {{{ 207 | syntax keyword ttCmdTime #tick[er] #delay 208 | \ nextgroup=ttTimeNameBlock 209 | \ skipwhite skipempty 210 | " }}} 211 | " Class: #class {{{ 212 | syntax keyword ttCmd #class 213 | \ nextgroup=ttClassNameBlock,ttClassName 214 | \ skipwhite skipempty 215 | " }}} 216 | " Local Echos: #echo #showme {{{ 217 | syntax keyword ttCmd #show[me] 218 | \ nextgroup=ttValueBlock 219 | \ skipwhite skipempty 220 | 221 | syntax keyword ttCmd #echo 222 | \ nextgroup=ttEchoBlock 223 | \ skipwhite skipempty 224 | " }}} 225 | " Path: #path {{{ 226 | syntax keyword ttCmd #path 227 | \ nextgroup=ttPathSub 228 | \ skipwhite skipempty 229 | " }}} 230 | " Log: #log {{{ 231 | syntax keyword ttCmd #log 232 | \ nextgroup=ttLogSub 233 | \ skipwhite skipempty 234 | " }}} 235 | " Line: #line {{{ 236 | syntax keyword ttCmd #line 237 | \ nextgroup=ttLineSub 238 | \ skipwhite skipempty 239 | " }}} 240 | " UnCommands: #un* {{{ 241 | syntax keyword ttCmdUn #unvar[iable] #untick[er] #undelay #unact[ion] #unevent #unfunc[tion] 242 | \ #unhigh[light] #unmacro #unprompt #unsub[sisitue] #untab #ungag #unalias 243 | \ nextgroup=ttUnBlock,ttUn 244 | \ skipwhite 245 | 246 | " }}} 247 | " Repeat Command: #{number} {{{ 248 | syntax match ttCmdRep "#\d\+" 249 | syntax match ttCmdRep "#{\d\+}" 250 | " }}} 251 | " #script is handled in a special way {{{ 252 | syntax keyword ttCmdScript #script 253 | " }}} 254 | " Map: #map {{{ 255 | syntax keyword ttCmd #map 256 | \ nextgroup=ttMapSub 257 | \ skipwhite skipempty 258 | " }}} 259 | syntax keyword ttCmd #chat 260 | " }}} 261 | syntax case match 262 | 263 | " Cluster ttCmd* into ttCmds {{{ 264 | syntax cluster ttCmds contains= 265 | \ ttCmd, 266 | \ ttCmdBranch, 267 | \ ttCmdDebug, 268 | \ ttCmdInput, 269 | \ ttCmdLoop, 270 | \ ttCmdRep, 271 | \ ttCmdSwitch, 272 | \ ttCmdTime, 273 | \ ttCmdTrigger, 274 | \ ttCmdUseless, 275 | \ ttCmdVar, 276 | \ ttCmdUn, 277 | \ ttCmdScript, 278 | " }}} 279 | 280 | " Blocks {{{ 281 | " General Blocks: 282 | " Pattern Match Blocks {{{ 283 | syntax region ttPatternBlock 284 | \ matchgroup=ttBracesMatch start=/{/ end=/}/ 285 | \ contained 286 | 287 | syntax region ttPatternBlockHigh 288 | \ matchgroup=ttBracesMatch start=/{/ end=/}/ 289 | \ contained skipwhite skipempty 290 | \ nextgroup=ttHighColorBlock 291 | 292 | syntax region ttPatternBlockSub 293 | \ matchgroup=ttBracesMatch start=/{/ end=/}/ 294 | \ contained skipwhite skipempty 295 | \ nextgroup=ttFormatBlock 296 | " }}} 297 | " Format Block {{{ 298 | syntax region ttFormatBlock 299 | \ matchgroup=ttBracesFormat start=/{/ end=/}/ 300 | \ contained 301 | 302 | syntax region ttReplaceFormatBlock 303 | \ matchgroup=ttBracesFormat start=/{/ end=/}/ 304 | \ contained 305 | " }}} 306 | " Value Blocks {{{ 307 | syntax region ttValueBlock 308 | \ matchgroup=ttBracesValue start=/{/ end=/}/ 309 | \ contained 310 | \ contains=ttValueBlock 311 | 312 | syntax region ttSplitValueBlock 313 | \ matchgroup=ttBracesValue start=/{/ end=/}/ 314 | \ contained skipwhite skipempty 315 | \ nextgroup=ttValueBlock 316 | 317 | syntax region ttParseValueBlock 318 | \ matchgroup=ttBracesValue start=/{/ end=/}/ 319 | \ contained skipwhite skipempty 320 | \ nextgroup=ttLoopVarBlock 321 | 322 | " }}} 323 | " Expression Block {{{ 324 | syntax region ttExpressionBlock 325 | \ matchgroup=ttBracesExpression start=/{/ end=/}/ 326 | \ contained 327 | " }}} 328 | " File Name Block {{{ 329 | syntax region ttFileNameBlock 330 | \ matchgroup=ttBraces start=/{/ end=/}/ 331 | \ contained 332 | 333 | syntax region ttFileName 334 | \ start=/\w/ skip=/\\\s/ end=/\( \|$\)/ 335 | \ contained 336 | \ contains=ttCmdSep 337 | " }}} 338 | " Key Block {{{ 339 | syntax region ttKeyBlock 340 | \ matchgroup=ttBraces start=/{/ end=/}/ 341 | \ contained 342 | " }}} 343 | " Shell Command Block {{{ 344 | syntax region ttShellCmd 345 | \ matchgroup=ttBraces start=/{/ end=/}/ 346 | \ contained 347 | \ contains=ttShellCmd 348 | " }}} 349 | " Blocks For Specefic Commands: 350 | " ListName Blocks {{{ 351 | syntax match ttListName "\c\%[{]\(act\%[ions]\|alias\%[es]\|class\%[es]\|config\%[urations]\|delay\%[s]\|event\%[s]\|func\%[tions]\|gag\[%s]\|high\%[lights]\|hist\%[ories]\|macro\%[s]\|path\%[s]\|pathdirs\|prompt\%[s]\|sub\%[stitutions]\|tab\%[s]\|tabcycle\|ticker\%[s]\|var\%[iables]\)\%[}]" 352 | \ contained 353 | \ contains=ttSubBrace 354 | 355 | syntax match ttListNameKill "\c\%[{]\(act\%[ions]\|alias\%[es]\|class\%[es]\|config\%[urations]\|delay\%[s]\|event\%[s]\|func\%[tions]\|gag\[%s]\|high\%[lights]\|hist\%[ories]\|macro\%[s]\|path\%[s]\|pathdirs\|prompt\%[s]\|sub\%[stitutions]\|tab\%[s]\|tabcycle\|ticker\%[s]\|var\%[iables]\)\%[}]" 356 | \ contains=ttSubBrace 357 | \ contained 358 | \ skipwhite skipempty 359 | \ nextgroup=ttPatternBlock 360 | " }}} 361 | " ForAll/ForEach LoopLower/LoopUpper {{{ 362 | syntax region ttForAllBlock 363 | \ matchgroup=ttBraces start=/{/ end=/}/ 364 | \ contained 365 | \ contains=ttValueBlock 366 | 367 | syntax region ttForEachBlock 368 | \ matchgroup=ttBraces start=/{/ end=/}/ 369 | \ contained 370 | \ contains=ttValueBlock 371 | \ skipwhite skipempty 372 | \ nextgroup=ttLoopVarBlock 373 | 374 | syntax region ttLoopVarBlock 375 | \ matchgroup=ttBraces start=/{/ end=/}/ 376 | \ contained 377 | 378 | syntax region ttLoopLowerBlock 379 | \ matchgroup=ttBraces start=/{/ end=/}/ 380 | \ contained 381 | \ skipwhite skipempty 382 | \ nextgroup=ttLoopUpperBlock 383 | 384 | syntax region ttLoopUpperBlock 385 | \ matchgroup=ttBraces start=/{/ end=/}/ 386 | \ contained 387 | \ skipwhite skipempty 388 | \ nextgroup=ttLoopVarBlock 389 | " }}} 390 | " Highlight Color Block {{{ 391 | syntax region ttHighColorBlock 392 | \ matchgroup=ttBraces start=/{/ end=/}/ 393 | \ contained 394 | " }}} 395 | " Functions Name Block {{{ 396 | syntax region ttFunctionNameBlock 397 | \ matchgroup=ttBraces start=/{/ end=/}/ 398 | \ contained 399 | " }}} 400 | " Variable Name Block {{{ 401 | syntax match ttVarVar "[^ ;]\+" 402 | \ contained 403 | \ contains=ttVarIndex 404 | \ skipwhite 405 | \ nextgroup=ttValueBlock 406 | 407 | syntax region ttVarVarBlock 408 | \ matchgroup=ttBraces start=/{/ end=/}/ 409 | \ contained 410 | \ contains=ttVarIndex 411 | \ skipwhite 412 | \ nextgroup=ttValueBlock 413 | 414 | syntax match ttFormatVar "[^ ;]\+" 415 | \ contained 416 | \ contains=ttVarIndex 417 | \ skipwhite 418 | \ nextgroup=ttFormatBlock 419 | 420 | syntax region ttFormatVarBlock 421 | \ matchgroup=ttBraces start=/{/ end=/}/ 422 | \ contained 423 | \ contains=ttVarIndex 424 | \ skipwhite skipempty 425 | \ nextgroup=ttFormatBlock 426 | 427 | syntax match ttMathVar "[^ ;]\+" 428 | \ contained 429 | \ contains=ttVarIndex 430 | \ skipwhite 431 | \ nextgroup=ttExpressionBlock 432 | 433 | syntax region ttMathVarBlock 434 | \ matchgroup=ttBraces start=/{/ end=/}/ 435 | \ contained 436 | \ contains=ttVarIndex 437 | \ skipwhite skipempty 438 | \ nextgroup=ttExpressionBlock 439 | 440 | syntax match ttMRegexVar "[^ ;]\+" 441 | \ contained 442 | \ contains=ttVarIndex 443 | \ skipwhite 444 | \ nextgroup=ttFormatBlock 445 | 446 | syntax region ttRegexVarBlock 447 | \ matchgroup=ttBraces start=/{/ end=/}/ 448 | \ contained 449 | \ contains=ttVarIndex 450 | \ skipwhite skipempty 451 | \ nextgroup=ttPatternBlock 452 | 453 | syntax match ttReplaceVar "[^ ;]\+" 454 | \ contained 455 | \ contains=ttVarIndex 456 | \ skipwhite 457 | \ nextgroup=ttReplaceFormatBlock 458 | 459 | syntax region ttReplaceVarBlock 460 | \ matchgroup=ttBraces start=/{/ end=/}/ 461 | \ contained 462 | \ contains=ttVarIndex 463 | \ skipwhite skipempty 464 | \ nextgroup=ttReplaceFormatBlock 465 | 466 | syntax match ttListVar "[^ ;]\+" 467 | \ contained 468 | \ contains=ttVarIndex 469 | \ skipwhite 470 | \ nextgroup=ttListSub 471 | 472 | syntax region ttListVarBlock 473 | \ matchgroup=ttBraces start=/{/ end=/}/ 474 | \ contained 475 | \ contains=ttVarIndex 476 | \ skipwhite skipempty 477 | \ nextgroup=ttListSub 478 | 479 | syntax match ttPathVar "[^ ;]\+" 480 | \ contained 481 | \ contains=ttVarIndex 482 | \ skipwhite 483 | \ nextgroup=ttListSub 484 | 485 | syntax region ttPathVarBlock 486 | \ matchgroup=ttBraces start=/{/ end=/}/ 487 | \ contained 488 | \ contains=ttVarIndex 489 | \ skipwhite skipempty 490 | \ nextgroup=ttListSub 491 | " }}} 492 | " Ticker/Delay Name {{{ 493 | syntax region ttTimeNameBlock 494 | \ matchgroup=ttBraces start=/{/ end=/}/ 495 | \ contained 496 | " }}} 497 | " Class Blocks {{{ 498 | syntax match ttClassName "[^ ;]\+" 499 | \ contained 500 | \ skipwhite 501 | \ nextgroup=ttClassSub 502 | 503 | syntax region ttClassNameBlock 504 | \ matchgroup=ttBraces start=/{/ end=/}/ 505 | \ contained 506 | \ skipwhite 507 | \ nextgroup=ttClassSub 508 | 509 | syntax match ttClassSub "\c\%[{]\(open\|close\|kill\)\%[}]" 510 | \ contained 511 | \ contains=ttSubBrace 512 | 513 | syntax match ttClassSub "\c\%[{]\(read\|write\)\%[}]" 514 | \ contained 515 | \ contains=ttSubBrace 516 | \ skipwhite 517 | \ nextgroup=ttFileNameBlock,ttFileName 518 | " }}} 519 | " List Block {{{ 520 | syntax match ttListSub "\c\%[{]\(add\|cl\%[ear]\|create\|del\%[ete]\|ins\%[ert]\|get\|set\|size\|sort\)\%[}]" 521 | \ contained 522 | \ contains=ttSubBrace 523 | " }}} 524 | " Map Block {{{ 525 | syntax match ttMapSub "\c\%[{]\(at\|create\|destroy\|info\|jump\|find\|flag\|get\|goto\|leave\|legend\|list\|map\|name\|resize\|return\|run\|undo\|vnum\)\%[}]" 526 | \ contained 527 | \ contains=ttSubBrace 528 | 529 | syntax match ttMapSub "\c\%[{]\(read\|write\)\%[}]" 530 | \ contained 531 | \ contains=ttSubBrace 532 | \ skipwhite skipempty 533 | \ nextgroup=ttFileNameBlock,ttFileName 534 | 535 | syntax match ttMapSub "\c\%[{]color\%[}]" 536 | \ contained 537 | \ contains=ttSubBrace 538 | \ skipwhite skipempty 539 | \ nextgroup=ttMapSubSubColor 540 | 541 | syntax match ttMapSub "\c\%[{]flag\%[}]" 542 | \ contained 543 | \ contains=ttSubBrace 544 | \ skipwhite skipempty 545 | \ nextgroup=ttMapSubSubFlag 546 | 547 | syntax match ttMapSub "\c\%[{]\(delete\|dig\|exit\%[flag]\|explore\|insert\|link\|move\|travel\|uninsert\|unlink\)\%[}]" 548 | \ contained 549 | \ contains=ttSubBrace 550 | \ skipwhite skipempty 551 | \ nextgroup=ttMapSubSubDirection 552 | 553 | syntax match ttMapSub "\c\%[{]roomflag\%[}]" 554 | \ contained 555 | \ contains=ttSubBrace 556 | \ skipwhite skipempty 557 | \ nextgroup=ttMapSubSubRoomFlag 558 | 559 | syntax match ttMapSub "\c\%[{]set\%[}]" 560 | \ contained 561 | \ contains=ttSubBrace 562 | \ skipwhite skipempty 563 | \ nextgroup=ttMapSubSubSet 564 | 565 | syntax match ttMapSubSubColor "\c\%[{]\(exit\|here\|path\|room\)\%[}]" 566 | \ contained 567 | \ contains=ttSubBrace 568 | 569 | syntax match ttMapSubSubFlag "\c\%[{]\(asciigraphics\|asciivnums\|mudfont\|nofollow\|static\|symbolgraphics\|vtmap\|vtgraphics\)\%[}]" 570 | \ contained 571 | \ contains=ttSubBrace 572 | 573 | syntax match ttMapSubSubDirection "\c\%[{]\(ne\|nw\|se\|sw\|n\|s\|e\|w\|w\|u\|d\)\%[}]" 574 | \ contained 575 | \ contains=ttSubBrace 576 | 577 | syntax match ttMapSubSubRoomFlag "\c\%[{]\(avoid\|hide\|leave\|void\|static\)\%[}]" 578 | \ contained 579 | \ contains=ttSubBrace 580 | 581 | syntax match ttMapSubSubSet "\c\%[{]room\(area\|color\|data\|desc\|flags\|name\|note\|symbol\|terrain\|weight\)\%[}]" 582 | \ contained 583 | \ contains=ttSubBrace 584 | " }}} 585 | " Path Block {{{ 586 | syntax match ttPathSub "\c\%[{]\(end\|del\|new\|run\|show\|walk\|zip\|unzip\)\%[}]" 587 | \ contained 588 | \ contains=ttSubBrace 589 | 590 | syntax match ttPathSub "\c\%[{]\(load\|save\)\%[}]" 591 | \ contained 592 | \ contains=ttSubBrace 593 | \ skipwhite 594 | \ nextgroup=ttPathVarBlock,ttPathVar 595 | 596 | syntax match ttPathSub "\c\%[{]\(ins\%[ert]\)\%[}]" 597 | \ contained 598 | \ contains=ttSubBrace 599 | \ skipwhite 600 | \ nextgroup=ttValueBlock 601 | " }}} 602 | " Log Block {{{ 603 | syntax match ttLogSub "\c\%[{]\(a\%[ppend]\|ov\%[erwrite]\|of\%[f]\)\%[}]" 604 | \ contained 605 | \ contains=ttSubBrace 606 | \ skipwhite 607 | \ nextgroup=ttFileNameBlock,ttFileName 608 | " }}} 609 | " Buffer Block {{{ 610 | syntax match ttBufferSub "\c\%[{]\(clear\|down\|end\|find\|home\|info\|lock\|up\)\%[}]" 611 | \ contained 612 | \ contains=ttSubBrace 613 | 614 | syntax match ttBufferSub "\c\%[{]write\%[}]" 615 | \ contained 616 | \ contains=ttSubBrace 617 | \ skipwhite 618 | \ nextgroup=ttFileNameBlock,ttFileName 619 | 620 | syntax match ttBufferSub "\c\%[{]get\%[}]" 621 | \ contained 622 | \ contains=ttSubBrace 623 | \ skipwhite 624 | " }}} 625 | " Event Name {{{ 626 | syntax region ttEventBlock 627 | \ matchgroup=ttBraces start=/{/ end=/}/ 628 | \ contained 629 | " }}} 630 | " Cursor Option {{{ 631 | syntax region ttCursorBlock 632 | \ matchgroup=ttBraces start=/{/ end=/}/ 633 | \ contained 634 | \ skipwhite skipempty 635 | \ nextgroup=ttKeyBlock 636 | " }}} 637 | "Session/Run Name Blocks {{{ 638 | syntax match ttSessionName "[^ ;]\+" 639 | \ contained 640 | 641 | syntax region ttSessionNameBlock 642 | \ matchgroup=ttBraces start=/{/ end=/}/ 643 | \ contained 644 | 645 | syntax match ttSesSessionName "[^ ;]\+" 646 | \ contained 647 | \ skipwhite 648 | \ nextgroup=ttSessionURIBlock,ttSessionURI 649 | 650 | syntax region ttSesSessionNameBlock 651 | \ matchgroup=ttBraces start=/{/ end=/}/ 652 | \ contained 653 | \ skipwhite 654 | \ nextgroup=ttSessionURIBlock,ttSessionURI 655 | 656 | syntax match ttRunSessionName "[^ ;]\+" 657 | \ contained 658 | \ skipwhite 659 | \ nextgroup=ttShellCmd 660 | 661 | syntax region ttRunSessionNameBlock 662 | \ matchgroup=ttBraces start=/{/ end=/}/ 663 | \ contained 664 | \ skipwhite 665 | \ nextgroup=ttShellCmd 666 | 667 | syntax match ttSessionURI "[^ ;]\+" 668 | \ contained 669 | \ skipwhite 670 | \ nextgroup=ttSessionPortBlock,ttSessionPort 671 | 672 | syntax region ttSessionURIBlock 673 | \ matchgroup=ttBraces start=/{/ end=/}/ 674 | \ contained 675 | \ skipwhite 676 | \ nextgroup=ttSessionPortBlock,ttSessionPort 677 | 678 | syntax match ttSessionPort "[^ ;]\+" 679 | \ contained 680 | 681 | syntax region ttSessionPortBlock 682 | \ matchgroup=ttBraces start=/{/ end=/}/ 683 | \ contained 684 | " }}} 685 | " History Block {{{ 686 | syntax match ttHistSub "\c\%[{]\(delete\|list\)\%[}]" 687 | \ contained 688 | \ contains=ttSubBrace 689 | 690 | syntax match ttHistSub "\c\%[{]insert\%[}]" 691 | \ contained 692 | \ contains=ttSubBrace 693 | \ skipwhite 694 | \ nextgroup=ttValueBlock 695 | 696 | syntax match ttHistSub "\c\%[{]\(write\|read\)\%[}]" 697 | \ contained 698 | \ contains=ttSubBrace 699 | \ skipwhite 700 | \ nextgroup=ttFileNameBlock,ttFileName 701 | " }}} 702 | " Echo Block {{{ 703 | syntax region ttEchoBlock 704 | \ matchgroup=ttBraces start=/{/ end=/}/ 705 | \ contained 706 | \ contains=ttFormatBlock,ttEchoNumberBlock 707 | 708 | syntax match ttEchoNumberBlock "{\d\+}" 709 | \ contained 710 | \ contains=ttCodeBlock 711 | " }}} 712 | " RegEx Matching Block {{{ 713 | syntax region ttRegExBlock 714 | \ matchgroup=ttRegExBraces start=/{/ end=/}/ 715 | \ contained 716 | \ contains=ttRegExBlock 717 | \ containedin=ttPatternBlock,ttPatternBlockSub,ttPatternBlockHigh 718 | " }}} 719 | " String Block {{{ 720 | syntax region ttString 721 | \ matchgroup=ttBraces start=/"/ skip=/\\"/ end=/"/ 722 | \ contained 723 | \ contains=ttRegExBlock 724 | \ containedin=ttExpressionBlock 725 | " }}} 726 | " Config Block {{{ 727 | syntax region ttConfigBlock 728 | \ matchgroup=ttBraces start=/{/ end=/}/ 729 | \ contained 730 | " }}} 731 | " Line Block {{{ 732 | syntax match ttLineSub "\c\%[{]\(gag\)\%[}]" 733 | \ contained 734 | \ contains=ttSubBrace 735 | 736 | syntax match ttLineSub "\c\%[{]\(strip\|ignore\|verbose\)\%[}]" 737 | \ contained 738 | \ contains=ttSubBrace 739 | 740 | syntax match ttLineSub "\c\%[{]\(sub\%[titute]\)\%[}]" 741 | \ contained 742 | \ contains=ttSubBrace 743 | \ skipwhite 744 | \ nextgroup=ttLineSubSub 745 | 746 | syntax match ttLineSub "\c\%[{]\(log\%[verbatim]\)\%[}]" 747 | \ contained 748 | \ contains=ttSubBrace 749 | \ skipwhite 750 | \ nextgroup=ttFileNameBlock,ttFileName 751 | 752 | syntax match ttLineSubSub "\c\%[{]\(var\%[iables]\|functions\|colors\|escapes\|secure\|eol\|lnf\)\%[}]" 753 | \ contained 754 | \ contains=ttSubBrace 755 | " }}} 756 | " Un* Block {{{ 757 | syntax region ttUnBlock 758 | \ matchgroup=ttBraces start=/{/ end=/}/ 759 | \ contained 760 | 761 | syntax match ttUn "[^;{} ]\+" 762 | \ contained 763 | " }}} 764 | " Generic Block: 765 | " Falls Back To Generic Code Block {{{ 766 | syntax region ttCodeBlock 767 | \ matchgroup=ttBraces start=/{/ end=/}/ 768 | \ contains=ttCodeBlock,ttCmdSep,@ttCmds,ttNopComment 769 | " }}} 770 | 771 | " Error Block: {{{ 772 | syntax region ttErrorBlock 773 | \ start=/\S\+/ end=/$\|;/ 774 | \ keepend 775 | \ contains=ttCmdSep 776 | \ contained 777 | " }}} 778 | " }}} 779 | 780 | " Syntax Elements {{{ 781 | " Numbers {{{ 782 | syntax match ttInt "\d\+" 783 | \ containedin=ttCodeBlock,ttValueBlock,ttTimeNameBlock,ttExpressionBlock,ttVarIndex,ttLoopLowerBlock,ttLoopUpperBlock,ttFuncBlock,ttSessionPort,ttSessionPortBlock 784 | syntax match ttFloat "\d\+.\d\+" 785 | \ containedin=ttCodeBlock,ttValueBlock,ttTimeNameBlock,ttExpressionBlock,ttVarIndex,ttLoopLowerBlock,ttLoopUpperBlock,ttFuncBlock,ttSessionPort,ttSessionPortBlock 786 | " }}} 787 | " Lazy Match Patterns {{{ 788 | syntax match ttMatchLazy "%[iIwWdDsS?.+*]" 789 | \ contained 790 | \ containedin=ttPatternBlock,ttPatternBlockHigh,ttPatternBlockSub,ttUn,ttUnBlock,ttReplaceFormatBlock,ttString 791 | " }}} 792 | " Match Special Regex Chars {{{ 793 | syntax match ttMatchSpecial "\^\|\~\|\$" 794 | \ contained 795 | \ containedin=ttPatternBlock,ttPatternBlockHigh,ttPatternBlockSub,ttReplaceFormatBlock 796 | " }}} 797 | " Format specifiers {{{ 798 | syntax match ttFormat "%\%[.+-][0-9]\{-}[acdghlmnprstuwACLRTU]" 799 | \ contained 800 | \ containedin=ttFormatBlock,ttEchoBlock 801 | " }}} 802 | " RexEx {{{ 803 | syntax match ttRegEx "\(\.\|+\|?\|*\|\\.\)" 804 | \ contained 805 | \ containedin=ttRegExBlock 806 | syntax match ttRegExBraces "\()\|(\|\]\|\[\||\)" 807 | \ contained 808 | \ containedin=ttRegExBlock 809 | " }}} 810 | " Math and Bitwise Operators {{{ 811 | syntax match ttOperators "\(<<\|>>\|==\|!=\|^^\|||\|&&\|[-+*%&/^|<>!=]\)" 812 | \ contained 813 | \ containedin=ttExpressionBlock 814 | syntax match ttOperatorsParen "[)(]" 815 | \ contained 816 | \ containedin=ttExpressionBlock 817 | " }}} 818 | " Color codes {{{ 819 | syntax match ttColor "<\d\d\d>" 820 | \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock 821 | syntax match ttColor "<[a-fA-F][a-fA-F][a-fA-F]>" 822 | \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock 823 | syntax match ttColor "<[gG]\d\{2}>" 824 | \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock 825 | " }}} 826 | " Dynamic Variables {{{ 827 | syntax match ttArgRef "%\d\{1,2}" 828 | \ containedin=ALLBUT,ttComment,ttNopComment 829 | 830 | syntax match ttRegExRef "&\d\{1,2}" 831 | \ containedin=ALLBUT,ttComment,ttNopComment 832 | " }}} 833 | " Character Escapes {{{ 834 | syntax match ttEsc "\\[0abcenrt\\]" 835 | \ containedin=ALLBUT,ttComment,ttNopComment 836 | syntax match ttEsc "\\x\x\{2}" 837 | \ containedin=ALLBUT,ttComment,ttNopComment 838 | syntax match ttEsc "\\\d\d\d" 839 | \ containedin=ALLBUT,ttComment,ttNopComment 840 | " }}} 841 | " ANSI Escape/Control Codes {{{ 842 | syntax match ttAnsiEsc /\\e\[[0-9;\\]\{-}m/ 843 | \ containedin=ALLBUT,ttComment,ttNopComment 844 | " }}} 845 | " tintin Variables {{{ 846 | syntax match ttVar "\$\%[{][a-zA-Z_]\+" 847 | \ nextgroup=ttVarIndex 848 | \ containedin=ALLBUT,ttComment,ttNopComment 849 | 850 | syntax match ttVar "&\%[{][a-zA-Z_]\+" 851 | \ nextgroup=ttVarIndex 852 | \ containedin=ALLBUT,ttComment,ttNopComment 853 | " }}} 854 | " Variable Blocks {{{ 855 | syntax region ttVarBlock 856 | \ matchgroup=ttVarBraces start=/${/ end=/}/ 857 | \ contains=ttVarIndex 858 | \ containedin=ALLBUT,ttComment,ttNopComment 859 | 860 | syntax region ttVarBlock 861 | \ matchgroup=ttVarBraces start=/&{/ end=/}/ 862 | \ contains=ttVarIndex 863 | \ containedin=ALLBUT,ttComment,ttNopComment 864 | " }}} 865 | " Variable Index {{{ 866 | syntax region ttVarIndex 867 | \ matchgroup=ttVarIndexBracket start=/\[/ end=/\]/ 868 | \ contained 869 | \ containedin=ttVarBlock 870 | \ transparent 871 | \ nextgroup=ttVarIndex 872 | " }}} 873 | " @function calls and the obligatory braces around the arguments {{{ 874 | syntax region ttFuncBlock 875 | \ matchgroup=ttBracesFunction start=/{/ skip=/$/ end=/}/ 876 | \ contains=ttCodeBlock 877 | \ contained 878 | 879 | syntax match ttFunction "@[A-Za-z_0-9]\+" 880 | \ containedin=ALLBUT,ttComment,ttNopComment 881 | \ nextgroup=ttFuncBlock 882 | " }}} 883 | " Optional SubCommand Braces {{{ 884 | syntax match ttSubBrace "{\|}" 885 | \ contained 886 | " }}} 887 | " Command Terminator {{{ 888 | syntax match ttCmdSep /;/ 889 | \ containedin=ttCodeBlock,ttFuncBlock,ttForAllBlock,ttForEachBlock 890 | " }}} 891 | " }}} 892 | 893 | " Comments {{{ 894 | " #nop comments 895 | syntax region ttNopComment 896 | \ matchgroup=ttNop start="#nop" end=/\;\|$/ 897 | 898 | " C-style multi-line comments 899 | syntax region ttComment start="/\*" end="\*/" 900 | 901 | syntax region ttCommentError start="/\*" end="\*/" 902 | \ contained 903 | \ containedin=ttCodeBlock 904 | 905 | " Special notes in Comments 906 | syntax keyword ttTodo TODO FIXME XXX BUG DEBUG 907 | \ contained 908 | \ containedin=ttComment,ttNopComment 909 | " }}} 910 | 911 | " Internal Highlink Linking {{{ 912 | 913 | " Link ttCmd* to ttCmd Group {{{ 914 | hi link ttCmdBranch ttCmd 915 | hi link ttCmdDebug ttCmd 916 | hi link ttCmdInput ttCmd 917 | hi link ttCmdLoop ttCmd 918 | hi link ttCmdRep ttCmd 919 | hi link ttCmdSwitch ttCmd 920 | hi link ttCmdTime ttCmd 921 | hi link ttCmdTrigger ttCmd 922 | hi link ttCmdUseless ttCmd 923 | hi link ttCmdVar ttCmd 924 | hi link ttCmdUn ttCmd 925 | hi link ttCmdScript ttCmd 926 | "}}} 927 | 928 | " Link Syntax Elements {{{ 929 | hi link ttMatchLazy ttMacro 930 | hi link ttMatchSpecial ttMacro 931 | hi link ttFormat ttMacro 932 | hi link ttRegEx ttMacro 933 | hi link ttRegExBraces ttBraces 934 | hi link ttColor ttMacro 935 | hi link ttEsc ttMacro 936 | hi link ttAnsiEsc ttMacro 937 | 938 | hi link ttArgRef ttReference 939 | hi link ttRegExRef ttReference 940 | " }}} 941 | 942 | " tintin Lists and Sub commands are keywords {{{ 943 | hi link ttListNameKill ttKeyword 944 | hi link ttListName ttKeyword 945 | hi link ttConfigBlock ttKeyword 946 | hi link ttListSub ttKeyword 947 | hi link ttPathSub ttKeyword 948 | hi link ttLogSub ttKeyword 949 | hi link ttClassSub ttKeyword 950 | hi link ttHistSub ttKeyword 951 | hi link ttEventBlock ttKeyword 952 | hi link ttCursorBlock ttKeyword 953 | hi link ttBufferSub ttKeyword 954 | hi link ttLineSub ttKeyword 955 | hi link ttLineSubSub ttKeyword 956 | hi link ttMapSub ttKeyword 957 | hi link ttMapSubSubSet ttKeyword 958 | hi link ttMapSubSubColor ttKeyword 959 | hi link ttMapSubSubFlag ttKeyword 960 | hi link ttMapSubSubRoomFlag ttKeyword 961 | hi link ttMapSubSubDirection ttKeyword 962 | " }}} 963 | 964 | hi link ttSessionURIBlock ttSessionURI 965 | hi link ttSessionURI ttString 966 | " Link all Braces together {{{ 967 | hi link ttBracesMatch ttBraces 968 | hi link ttBracesFormat ttBraces 969 | hi link ttBracesValue ttBraces 970 | hi link ttBracesExpression ttBraces 971 | hi link ttVarIndexBracket ttBraces 972 | hi link ttRegExBraces ttBraces 973 | hi link ttOperatorsParen ttBraces 974 | hi link ttSubBrace ttBraces 975 | " }}} 976 | hi link ttBracesFunction ttFunction 977 | " Link Various Variable Names to ttVarName {{{ 978 | hi link ttLoopVarBlock ttVarName 979 | hi link ttMathVarBlock ttVarName 980 | hi link ttFormatVarBlock ttVarName 981 | hi link ttRegexVarBlock ttVarName 982 | hi link ttReplaceVarBlock ttVarName 983 | hi link ttVarVarBlock ttVarName 984 | hi link ttListVarBlock ttVarName 985 | hi link ttPathVarBlock ttVarName 986 | hi link ttVarVar ttVarName 987 | hi link ttMathVar ttVarName 988 | hi link ttFormatVar ttVarName 989 | hi link ttRegexVar ttVarName 990 | hi link ttReplaceVar ttVarName 991 | hi link ttListVar ttVarName 992 | hi link ttPathVar ttVarName 993 | hi link ttScriptVarNameVar ttVarName 994 | " }}} 995 | " Link all pattern blocks together {{{ 996 | hi link ttPatternBlockHigh ttPatternBlock 997 | hi link ttPatternBlockSub ttPatternBlock 998 | " }}} 999 | " Link all names to ttIdentifier {{{ 1000 | hi link ttClassName ttIdentifier 1001 | hi link ttClassNameBlock ttIdentifier 1002 | hi link ttTimeNameBlock ttIdentifier 1003 | hi link ttSessionName ttIdentifier 1004 | hi link ttSessionNameBlock ttIdentifier 1005 | hi link ttSesSessionName ttIdentifier 1006 | hi link ttSesSessionNameBlock ttIdentifier 1007 | hi link ttRunSessionName ttIdentifier 1008 | hi link ttRunSessionNameBlock ttIdentifier 1009 | hi link ttUnBlock ttIdentifier 1010 | hi link ttUn ttIdentifier 1011 | " }}} 1012 | " Link various number types to ttNumber {{{ 1013 | hi link ttInt ttNumber 1014 | hi link ttFloat ttNumber 1015 | " }}} 1016 | hi link ttFunctionNameBlock ttFunction 1017 | hi link ttFileNameBlock ttFileName 1018 | hi link ttScriptShell ttShellCmd 1019 | hi link ttVarBlock ttVar 1020 | hi link ttVarBraces ttVar 1021 | hi link ttNopComment ttComment 1022 | hi link ttNop ttCmd 1023 | hi link ttCommentError ttError 1024 | hi link ttErrorBlock ttError 1025 | " }}} 1026 | 1027 | " Link tt Highlighting Groups to Default Groups {{{ 1028 | hi default link ttVar Special 1029 | hi default link ttCmd Statement 1030 | hi default link ttBraces Delimiter 1031 | hi default link ttCmdSep Delimiter 1032 | hi default link ttFileName Character 1033 | hi default link ttReference Special 1034 | hi default link ttMacro Macro 1035 | hi default link ttKeyword Keyword 1036 | hi default link ttFunction Function 1037 | hi default link ttShellCmd Character 1038 | hi default link ttVarName Identifier 1039 | hi default link ttIdentifier Identifier 1040 | hi default link ttNumber Number 1041 | hi default link ttString String 1042 | hi default link ttOperators Operator 1043 | hi default link ttCodeBlock Structure 1044 | hi default link ttTodo Todo 1045 | hi default link ttComment Comment 1046 | hi default link ttError Error 1047 | " }}} 1048 | 1049 | let b:current_syntax = "tt" 1050 | --------------------------------------------------------------------------------