Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Smarty Templates |
| 3 | " Maintainer: Manfred Stienstra manfred.stienstra@dwerg.net |
| 4 | " Last Change: Mon Nov 4 11:42:23 CET 2002 |
| 5 | " Filenames: *.tpl |
| 6 | " URL: http://www.dwerg.net/projects/vim/smarty.vim |
| 7 | |
| 8 | " For version 5.x: Clear all syntax items |
| 9 | " For version 6.x: Quit when a syntax file was already loaded |
| 10 | if !exists("main_syntax") |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | let main_syntax = 'smarty' |
| 17 | endif |
| 18 | |
| 19 | syn case ignore |
| 20 | |
| 21 | runtime! syntax/html.vim |
| 22 | "syn cluster htmlPreproc add=smartyUnZone |
| 23 | |
| 24 | syn match smartyBlock contained "[\[\]]" |
| 25 | |
| 26 | syn keyword smartyTagName capture config_load include include_php |
| 27 | syn keyword smartyTagName insert if elseif else ldelim rdelim literal |
| 28 | syn keyword smartyTagName php section sectionelse foreach foreachelse |
| 29 | syn keyword smartyTagName strip assign counter cycle debug eval fetch |
| 30 | syn keyword smartyTagName html_options html_select_date html_select_time |
| 31 | syn keyword smartyTagName math popup_init popup html_checkboxes html_image |
| 32 | syn keyword smartyTagName html_radios html_table mailto textformat |
| 33 | |
| 34 | syn keyword smartyModifier cat capitalize count_characters count_paragraphs |
| 35 | syn keyword smartyModifier count_sentences count_words date_format default |
| 36 | syn keyword smartyModifier escape indent lower nl2br regex_replace replace |
| 37 | syn keyword smartyModifier spacify string_format strip strip_tags truncate |
| 38 | syn keyword smartyModifier upper wordwrap |
| 39 | |
| 40 | syn keyword smartyInFunc neq eq |
| 41 | |
| 42 | syn keyword smartyProperty contained "file=" |
| 43 | syn keyword smartyProperty contained "loop=" |
| 44 | syn keyword smartyProperty contained "name=" |
| 45 | syn keyword smartyProperty contained "include=" |
| 46 | syn keyword smartyProperty contained "skip=" |
| 47 | syn keyword smartyProperty contained "section=" |
| 48 | |
| 49 | syn keyword smartyConstant "\$smarty" |
| 50 | |
| 51 | syn keyword smartyDot . |
| 52 | |
| 53 | syn region smartyZone matchgroup=Delimiter start="{" end="}" contains=smartyProperty, smartyString, smartyBlock, smartyTagName, smartyConstant, smartyInFunc, smartyModifier |
| 54 | |
| 55 | syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,smartyZone |
| 56 | syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,smartyZone |
| 57 | syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,javaScript,@htmlPreproc,smartyZone |
| 58 | |
| 59 | |
| 60 | if version >= 508 || !exists("did_smarty_syn_inits") |
| 61 | if version < 508 |
| 62 | let did_smarty_syn_inits = 1 |
| 63 | command -nargs=+ HiLink hi link <args> |
| 64 | else |
| 65 | command -nargs=+ HiLink hi def link <args> |
| 66 | endif |
| 67 | |
| 68 | HiLink smartyTagName Identifier |
| 69 | HiLink smartyProperty Constant |
| 70 | " if you want the text inside the braces to be colored, then |
| 71 | " remove the comment in from of the next statement |
| 72 | "HiLink smartyZone Include |
| 73 | HiLink smartyInFunc Function |
| 74 | HiLink smartyBlock Constant |
| 75 | HiLink smartyDot SpecialChar |
| 76 | HiLink smartyModifier Function |
| 77 | delcommand HiLink |
| 78 | endif |
| 79 | |
| 80 | let b:current_syntax = "smarty" |
| 81 | |
| 82 | if main_syntax == 'smarty' |
| 83 | unlet main_syntax |
| 84 | endif |
| 85 | |
| 86 | " vim: ts=8 |