Skip to content

Commit 4a00e3d

Browse files
Ken Earlvim-scripts
Ken Earl
authored andcommitted
Version 1: Initial upload
0 parents  commit 4a00e3d

File tree

2 files changed

+253
-0
lines changed

2 files changed

+253
-0
lines changed

README

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1798
2+
3+
A friend and I found that there were no acceptable vim syntax files for smarty, so we took the only one we could find and added everything from the smarty documentation (http://smarty.php.net/manual/en) to it. If nothing else, this is a very good start on a complete smarty syntax file. We have even used vimtip #498 to use autocomplete with this syntax and so far it seems to work well.

syntax/smarty.vim

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

0 commit comments

Comments
 (0)