|
| 1 | +" Vim syntax file |
| 2 | +" Language: Route files for Minima (github.com/tessarin/minima) |
| 3 | +" Maintainer: Cesar Tessarin <[email protected]> |
| 4 | +" Last Change: 2025 Jul 17 |
| 5 | +" Repository: github.com/tessarin/vim-minima |
| 6 | +" --------------------------------------------------------------------- |
| 7 | + |
| 8 | +if exists("b:current_syntax") |
| 9 | + finish |
| 10 | +end |
| 11 | + |
| 12 | +" Add special character used in methods |
| 13 | +setlocal iskeyword+=*,@-@ |
| 14 | + |
| 15 | +" First column: method or directive |
| 16 | +syn keyword mVerb |
| 17 | + \ GET _GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE PATCH |
| 18 | + |
| 19 | +syn keyword mAnyVerb * |
| 20 | + |
| 21 | +syn keyword mDirectiveMark @ |
| 22 | + \ nextgroup=mDirectiveName skipwhite |
| 23 | + |
| 24 | +" Second column: pattern or directive name |
| 25 | +syn match mPattern /\/\S*/ |
| 26 | + \ contains=mPatternGroup nextgroup=mController skipwhite |
| 27 | + |
| 28 | +syn region mPatternGroup start="{" end="}" |
| 29 | + \ contains=mPatternGroup contained |
| 30 | + |
| 31 | +syn keyword mDirectiveName not_found server_error |
| 32 | + \ contained nextgroup=mController skipwhite |
| 33 | + |
| 34 | +" Third column: controller |
| 35 | +syn match mController /\S\+/ |
| 36 | + \ contained nextgroup=mMethod skipwhite |
| 37 | + |
| 38 | +" Fourth column: method |
| 39 | +syn match mMethod /\S\+/ contained |
| 40 | + |
| 41 | +" Comments |
| 42 | +syn keyword mTodo TODO XXX contained |
| 43 | +syn match mComment /^#.*/ contains=mTodo |
| 44 | + |
| 45 | +hi def link mVerb Type |
| 46 | +hi def link mAnyVerb Special |
| 47 | +hi def link mDirectiveMark Statement |
| 48 | + |
| 49 | +hi def link mPattern String |
| 50 | +hi def link mPatternGroup SpecialChar |
| 51 | +hi def link mDirectiveName Statement |
| 52 | + |
| 53 | +hi def link mController Function |
| 54 | + |
| 55 | +hi def link mMethod Identifier |
| 56 | + |
| 57 | +hi def link mTodo Todo |
| 58 | +hi def link mComment Comment |
| 59 | + |
| 60 | +let b:current_syntax = "mroutes" |
0 commit comments