dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

smarty.vim (12370B)


      1 " Vim syntax file
      2 " Language:	Smarty Templates
      3 " Maintainer:	Daniel Hahler, original: Manfred Stienstra manfred.stienstra@dwerg.net
      4 " Last Change:  Di 10 Jun 2014 15:09:10 CEST
      5 " Filenames:    *.tpl
      6 " URL:		https://github.com/blueyed/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 unlet b:current_syntax
     23 syn cluster htmlPreproc add=smartyZone add=smartyComment add=smartyEndTag
     24 
     25 syn keyword smartyTagName contained capture config_load include include_php
     26 syn keyword smartyTagName contained insert ldelim rdelim literal
     27 syn keyword smartyTagName contained php
     28 syn keyword smartyTagName contained strip config_load assign debug
     29 syn keyword smartyTagName contained eval fetch html_checkboxes html_image
     30 syn keyword smartyTagName contained html_options html_radios html_select_date
     31 syn keyword smartyTagName contained html_select_time html_table mailto
     32 syn keyword smartyTagName contained math popup popup_init textformat
     33 
     34 syn keyword smartyConditional contained if elseif else
     35 syn keyword smartyRepeat contained section sectionelse foreach foreachelse cycle counter
     36 
     37 syn cluster smartyTags add=smartyTagName add=smartyConditional add=smartyRepeat
     38 
     39 syn keyword smartyInFunc ne eq == != > < >= <= === ! %
     40 
     41 syn match smartyProperty contained "file="
     42 syn match smartyProperty contained "loop="
     43 syn match smartyProperty contained "name="
     44 syn match smartyProperty contained "include="
     45 syn match smartyProperty contained "skip="
     46 syn match smartyProperty contained "section="
     47 syn match smartyProperty contained "from="
     48 syn match smartyProperty contained "item="
     49 syn match smartyProperty contained "key="
     50 syn match smartyProperty contained "once="
     51 syn match smartyProperty contained "global="
     52 syn match smartyProperty contained "scope="
     53 syn match smartyProperty contained "script="
     54 syn match smartyProperty contained "assign="
     55 syn match smartyProperty contained "start="
     56 syn match smartyProperty contained "stop="
     57 syn match smartyProperty contained "max="
     58 syn match smartyProperty contained "show="
     59 syn match smartyProperty contained "step="
     60 syn match smartyProperty contained "var="
     61 syn match smartyProperty contained "value="
     62 syn match smartyProperty contained "skip="
     63 syn match smartyProperty contained "direction="
     64 syn match smartyProperty contained "print="
     65 syn match smartyProperty contained "advance="
     66 syn match smartyProperty contained "delimiter="
     67 syn match smartyProperty contained "reset="
     68 syn match smartyProperty contained "output="
     69 syn match smartyProperty contained "selected="
     70 syn match smartyProperty contained "options="
     71 syn match smartyProperty contained "separator="
     72 syn match smartyProperty contained "labels="
     73 syn match smartyProperty contained "height="
     74 syn match smartyProperty contained "width="
     75 syn match smartyProperty contained "basedir="
     76 syn match smartyProperty contained "alt="
     77 syn match smartyProperty contained "href="
     78 syn match smartyProperty contained "path_prefix="
     79 syn match smartyProperty contained "values="
     80 syn match smartyProperty contained "prefix="
     81 syn match smartyProperty contained "time="
     82 syn match smartyProperty contained "start_year="
     83 syn match smartyProperty contained "end_year="
     84 syn match smartyProperty contained "display_days="
     85 syn match smartyProperty contained "display_months="
     86 syn match smartyProperty contained "display_years="
     87 syn match smartyProperty contained "month_format="
     88 syn match smartyProperty contained "day_format="
     89 syn match smartyProperty contained "day_value_format="
     90 syn match smartyProperty contained "year_as_text="
     91 syn match smartyProperty contained "reverse_years="
     92 syn match smartyProperty contained "day_size="
     93 syn match smartyProperty contained "month_size="
     94 syn match smartyProperty contained "year_size="
     95 syn match smartyProperty contained "day_extra="
     96 syn match smartyProperty contained "month_extra="
     97 syn match smartyProperty contained "year_extra="
     98 syn match smartyProperty contained "field_order="
     99 syn match smartyProperty contained "field_separator="
    100 syn match smartyProperty contained "month_value_format="
    101 syn match smartyProperty contained "year_empty="
    102 syn match smartyProperty contained "month_empty="
    103 syn match smartyProperty contained "day_empty="
    104 syn match smartyProperty contained "display_hours="
    105 syn match smartyProperty contained "display_minutes="
    106 syn match smartyProperty contained "display_seconds="
    107 syn match smartyProperty contained "minute_interval="
    108 syn match smartyProperty contained "second_interval="
    109 syn match smartyProperty contained "field_array="
    110 syn match smartyProperty contained "all_extra="
    111 syn match smartyProperty contained "hour_extra="
    112 syn match smartyProperty contained "minute_extra="
    113 syn match smartyProperty contained "second_extra="
    114 syn match smartyProperty contained "meridian_extra="
    115 syn match smartyProperty contained "display_meridian="
    116 syn match smartyProperty contained "use_24_hours="
    117 syn match smartyProperty contained "cols="
    118 syn match smartyProperty contained "rows="
    119 syn match smartyProperty contained "inner="
    120 syn match smartyProperty contained "caption="
    121 syn match smartyProperty contained "table_attr="
    122 syn match smartyProperty contained "th_attr="
    123 syn match smartyProperty contained "tr_attr="
    124 syn match smartyProperty contained "td_attr="
    125 syn match smartyProperty contained "trailpad="
    126 syn match smartyProperty contained "hdir="
    127 syn match smartyProperty contained "vdir="
    128 syn match smartyProperty contained "address="
    129 syn match smartyProperty contained "text="
    130 syn match smartyProperty contained "encode="
    131 syn match smartyProperty contained "cc="
    132 syn match smartyProperty contained "bcc="
    133 syn match smartyProperty contained "subject="
    134 syn match smartyProperty contained "newsgroups="
    135 syn match smartyProperty contained "followupto="
    136 syn match smartyProperty contained "extra="
    137 syn match smartyProperty contained "equation="
    138 syn match smartyProperty contained "format="
    139 syn match smartyProperty contained "trigger="
    140 syn match smartyProperty contained "sticky="
    141 syn match smartyProperty contained "caption="
    142 syn match smartyProperty contained "fgcolor="
    143 syn match smartyProperty contained "bgcolor="
    144 syn match smartyProperty contained "textcolor="
    145 syn match smartyProperty contained "capcolor="
    146 syn match smartyProperty contained "closecolor="
    147 syn match smartyProperty contained "textfont="
    148 syn match smartyProperty contained "captionfont="
    149 syn match smartyProperty contained "closefont="
    150 syn match smartyProperty contained "textsize="
    151 syn match smartyProperty contained "captionsize="
    152 syn match smartyProperty contained "closesize="
    153 syn match smartyProperty contained "width="
    154 syn match smartyProperty contained "height="
    155 syn match smartyProperty contained "left="
    156 syn match smartyProperty contained "right="
    157 syn match smartyProperty contained "center="
    158 syn match smartyProperty contained "above="
    159 syn match smartyProperty contained "below="
    160 syn match smartyProperty contained "border="
    161 syn match smartyProperty contained "offsetx="
    162 syn match smartyProperty contained "offsety="
    163 syn match smartyProperty contained "fgbackground="
    164 syn match smartyProperty contained "bgbackground="
    165 syn match smartyProperty contained "closetext="
    166 syn match smartyProperty contained "noclose="
    167 syn match smartyProperty contained "status="
    168 syn match smartyProperty contained "autostatus="
    169 syn match smartyProperty contained "autostatuscap="
    170 syn match smartyProperty contained "inarray="
    171 syn match smartyProperty contained "caparray="
    172 syn match smartyProperty contained "capicon="
    173 syn match smartyProperty contained "snapx="
    174 syn match smartyProperty contained "snapy="
    175 syn match smartyProperty contained "fixx="
    176 syn match smartyProperty contained "fixy="
    177 syn match smartyProperty contained "background="
    178 syn match smartyProperty contained "padx="
    179 syn match smartyProperty contained "pady="
    180 syn match smartyProperty contained "fullhtml="
    181 syn match smartyProperty contained "frame="
    182 syn match smartyProperty contained "function="
    183 syn match smartyProperty contained "delay="
    184 syn match smartyProperty contained "hauto="
    185 syn match smartyProperty contained "indent="
    186 syn match smartyProperty contained "indent_first="
    187 syn match smartyProperty contained "indent_char="
    188 syn match smartyProperty contained "wrap="
    189 syn match smartyProperty contained "wrap_char="
    190 syn match smartyProperty contained "vauto="
    191 syn match smartyProperty contained "wrap_cut="
    192 
    193 
    194 " Number
    195 syn match smartyNumber "-\=\<\d\+\>" contained display
    196 syn match smartyNumber "\<0x\x\{1,8}\>"  contained display
    197 
    198 " Boolean
    199 syn keyword smartyBoolean contained true false
    200 
    201 " Operator
    202 syn match smartyOperator contained "||\|&&"
    203 
    204 
    205 syn match smartyConstant contained "\$smarty"
    206 
    207 syn match smartyDollarSign      contained "\$" " nextgroup=smartyVariable
    208 syn match smartyMaybeDollarSign contained "\([^\\]\|\\\\\)\@<=\$"
    209 
    210 syn match smartyVariable      contained "\$\@<=\(\h\w\{-}\(\.\|\->\|\[\w\{-}\]\(\.\|\->\)\)\)*\w*" contains=smartyGlue nextgroup=smartyFunctionArgs
    211 
    212 syn region smartyFunctionArgs contained matchgroup=Delimiter start="(" end=")" contains=@phpClConst
    213 syn match smartyMaybeVariable contained "\(\(^\|[^\\]\|\\\\\)\$\)\@<=\h\w*"
    214 
    215 syn match smartyEscapedVariable contained "\\$\h\w*"
    216 
    217 syn region smartyInBracket    contained matchgroup=Constant start=+\[+ end=+\]+ contains=smartyVariable
    218 syn region smartyInBacktick   contained matchgroup=Constant start=+\`+ end=+\`+ contains=smartyVariable
    219 syn region smartyStringDouble contained matchgroup=Constant start=+"+  end=+"+  contains=smartyMaybeVariable, smartyInBacktick, smartyMaybeDollarSign keepend
    220 
    221 syn match smartyGlue contained "\.\|\->"
    222 
    223 
    224 syn region smartyModifier  contained matchgroup=Statement start=+||\@!+      end=+\ze:\|\>+
    225 syn region smartyParameter contained matchgroup=Statement start=+:+          end=+\ze\(}\||\)+ contains=smartyVariable, smartyDollarSign, smartyGlue, smartyInBracket, smartyStringDouble contained
    226 syn region smartyZone                matchgroup=Statement start="{\s\{-}[a-z$]\@=" end="}" contains=smartyParameter, smartyProperty, smartyGlue, smartyModifier, smartyDollarSign, smartyInBracket, smartyStringDouble, smartyVariable, smartyString, smartyBlock, smartyTagName, smartyConstant, smartyInFunc, @smartyTags, smartyRepeat, smartyNumber, smartyBoolean, smartyOperator, smartyTodo
    227 syn region smartyEndTag   matchgroup=Statement start="{/"  end="}"  contains=@smartyTags
    228 syn region smartyComment  matchgroup=Comment   start="{\*" end="\*}" contains=smartyTodo
    229 
    230 syn keyword smartyTodo   contained FIXME NOTE TODO OPTIMIZE XXX
    231 
    232 syn region  htmlString   contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,smartyZone
    233 syn region  htmlString   contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,smartyZone
    234   " syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,javaScript,@htmlPreproc,smartyZone
    235 
    236 
    237 if version >= 508 || !exists("did_smarty_syn_inits")
    238   if version < 508
    239     let did_smarty_syn_inits = 1
    240     command -nargs=+ HiLink hi link <args>
    241   else
    242     command -nargs=+ HiLink hi def link <args>
    243   endif
    244 
    245   HiLink smartyTagName         Function
    246   HiLink smartyProperty        Type
    247   HiLink smartyComment         Comment
    248   HiLink smartyInFunc          Function
    249   HiLink smartyBlock           Constant
    250   HiLink smartyGlue            Statement
    251   HiLink smartyVariable        Identifier
    252   HiLink smartyDollarSign      Statement
    253   HiLink smartyMaybeVariable   Identifier
    254   HiLink smartyMaybeDollarSign Statement
    255   HiLink smartyStringDouble    Special
    256   HiLink smartyInBracket       PreProc
    257   HiLink smartyInBacktick      Statement
    258   HiLink smartyModifier        Special
    259   HiLink smartyConditional     Conditional
    260   HiLink smartyRepeat          Repeat
    261   HiLink smartyBoolean         Boolean
    262   HiLink smartyNumber          Number
    263   HiLink smartyOperator        Operator
    264   HiLink smartyTodo            Todo
    265   delcommand HiLink
    266 endif
    267 
    268 
    269 " Match/delegate {php}..{/php} blocks.
    270 syn include syntax/php.vim
    271 syn region   phpRegion  matchgroup=Delimiter start="{php}" end="{/php}" contains=@phpClTop
    272 
    273 let b:current_syntax = "smarty"
    274 
    275 if main_syntax == 'smarty'
    276   unlet main_syntax
    277 endif
    278 
    279 " vim: ts=8