annotate .vim/syntax/django.vim @ 156:59ea03d7029a

vcs_functions: add a function to grab the path of the next unmerged file from git
author Augie Fackler <durin42@gmail.com>
date Tue, 24 Nov 2009 14:13:46 -0600
parents c30d68fbd368
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 " Vim syntax file
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 " Language: Django template
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 " Maintainer: Dave Hodder <dmh@dmh.org.uk>
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 " Last Change: 2007 Apr 21
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 " For version 5.x: Clear all syntax items
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 " For version 6.x: Quit when a syntax file was already loaded
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 if version < 600
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 syntax clear
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 elseif exists("b:current_syntax")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 finish
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 endif
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 syntax case match
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 " Mark illegal characters
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 syn match djangoError "%}\|}}\|#}"
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 " Django template built-in tags and parameters
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 " 'comment' doesn't appear here because it gets special treatment
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 syn keyword djangoStatement contained and as block endblock by cycle debug else
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 syn keyword djangoStatement contained extends filter endfilter firstof for
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 syn keyword djangoStatement contained endfor if endif ifchanged endifchanged
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 syn keyword djangoStatement contained ifequal endifequal ifnotequal
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 syn keyword djangoStatement contained endifnotequal in include load not now or
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 syn keyword djangoStatement contained parsed regroup reversed spaceless
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 syn keyword djangoStatement contained endspaceless ssi templatetag openblock
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 syn keyword djangoStatement contained closeblock openvariable closevariable
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 syn keyword djangoStatement contained openbrace closebrace opencomment
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 syn keyword djangoStatement contained closecomment widthratio url with endwith
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 syn keyword djangoStatement contained get_current_language trans noop blocktrans
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 syn keyword djangoStatement contained endblocktrans get_available_languages
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 syn keyword djangoStatement contained get_current_language_bidi plural
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 " Django templete built-in filters
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 syn keyword djangoFilter contained add addslashes capfirst center cut date
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 syn keyword djangoFilter contained default default_if_none dictsort
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 syn keyword djangoFilter contained dictsortreversed divisibleby escape
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 syn keyword djangoFilter contained filesizeformat first fix_ampersands
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 syn keyword djangoFilter contained floatformat get_digit join length length_is
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 syn keyword djangoFilter contained lower make_list phone2numeric pluralize
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 syn keyword djangoFilter contained pprint random removetags rjust slice slugify
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 syn keyword djangoFilter contained stringformat striptags
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 syn keyword djangoFilter contained time timesince timeuntil title
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 syn keyword djangoFilter contained truncatewords unordered_list upper urlencode
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 " Keywords to highlight within comments
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 syn keyword djangoTodo contained TODO FIXME XXX
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 " Django template constants (always surrounded by double quotes)
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 syn region djangoArgument contained start=/"/ skip=/\\"/ end=/"/
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 " Mark illegal characters within tag and variables blocks
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 syn match djangoTagError contained "#}\|{{\|[^%]}}\|[<>!&#]"
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 syn match djangoVarError contained "#}\|{%\|%}\|[<>!&#%]"
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 " Django template tag and variable blocks
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60 syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 " Django template 'comment' tag and comment block
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 syn region djangoComment start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=djangoTodo
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 syn region djangoComBlock start="{#" end="#}" contains=djangoTodo
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 " Define the default highlighting.
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 " For version 5.7 and earlier: only when not done already
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 " For version 5.8 and later: only when an item doesn't have highlighting yet
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 if version >= 508 || !exists("did_django_syn_inits")
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71 if version < 508
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 let did_django_syn_inits = 1
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 command -nargs=+ HiLink hi link <args>
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74 else
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 command -nargs=+ HiLink hi def link <args>
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 endif
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 HiLink djangoTagBlock PreProc
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
79 HiLink djangoVarBlock PreProc
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80 HiLink djangoStatement Statement
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 HiLink djangoFilter Identifier
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 HiLink djangoArgument Constant
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
83 HiLink djangoTagError Error
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
84 HiLink djangoVarError Error
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85 HiLink djangoError Error
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 HiLink djangoComment Comment
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87 HiLink djangoComBlock Comment
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 HiLink djangoTodo Todo
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 delcommand HiLink
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 endif
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
92
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
93 let b:current_syntax = "django"