Mercurial > vim
annotate runtime/syntax/django.vim @ 6925:30c9301f33ed v7.4.781
patch 7.4.781
Problem: line2byte() returns one less when 'bin' and 'noeol' are set.
Solution: Only adjust the size for the last line. (Rob Wu)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 12 Jul 2015 17:52:57 +0200 |
parents | 7090d7f160f7 |
children | 43efa4f5a8ea |
rev | line source |
---|---|
798 | 1 " Vim syntax file |
2 " Language: Django template | |
3 " Maintainer: Dave Hodder <dmh@dmh.org.uk> | |
6091
7090d7f160f7
Update runtime files. Add vroom file support.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
4 " Last Change: 2014 Jul 13 |
798 | 5 |
6 " For version 5.x: Clear all syntax items | |
7 " For version 6.x: Quit when a syntax file was already loaded | |
8 if version < 600 | |
9 syntax clear | |
10 elseif exists("b:current_syntax") | |
11 finish | |
12 endif | |
13 | |
14 syntax case match | |
15 | |
1123 | 16 " Mark illegal characters |
17 syn match djangoError "%}\|}}\|#}" | |
18 | |
798 | 19 " Django template built-in tags and parameters |
20 " 'comment' doesn't appear here because it gets special treatment | |
2200
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
21 syn keyword djangoStatement contained autoescape csrf_token empty |
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
22 " FIXME ==, !=, <, >, <=, and >= should be djangoStatements: |
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
23 " syn keyword djangoStatement contained == != < > <= >= |
3465 | 24 syn keyword djangoStatement contained and as block endblock by cycle debug else elif |
2200
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
25 syn keyword djangoStatement contained extends filter endfilter firstof for |
798 | 26 syn keyword djangoStatement contained endfor if endif ifchanged endifchanged |
27 syn keyword djangoStatement contained ifequal endifequal ifnotequal | |
28 syn keyword djangoStatement contained endifnotequal in include load not now or | |
29 syn keyword djangoStatement contained parsed regroup reversed spaceless | |
30 syn keyword djangoStatement contained endspaceless ssi templatetag openblock | |
31 syn keyword djangoStatement contained closeblock openvariable closevariable | |
1123 | 32 syn keyword djangoStatement contained openbrace closebrace opencomment |
1215 | 33 syn keyword djangoStatement contained closecomment widthratio url with endwith |
1123 | 34 syn keyword djangoStatement contained get_current_language trans noop blocktrans |
35 syn keyword djangoStatement contained endblocktrans get_available_languages | |
36 syn keyword djangoStatement contained get_current_language_bidi plural | |
798 | 37 |
38 " Django templete built-in filters | |
39 syn keyword djangoFilter contained add addslashes capfirst center cut date | |
40 syn keyword djangoFilter contained default default_if_none dictsort | |
2034 | 41 syn keyword djangoFilter contained dictsortreversed divisibleby escape escapejs |
798 | 42 syn keyword djangoFilter contained filesizeformat first fix_ampersands |
2200
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
43 syn keyword djangoFilter contained floatformat get_digit join last length length_is |
798 | 44 syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust |
45 syn keyword djangoFilter contained lower make_list phone2numeric pluralize | |
2200
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
46 syn keyword djangoFilter contained pprint random removetags rjust slice slugify |
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
47 syn keyword djangoFilter contained safe safeseq stringformat striptags |
3465 | 48 syn keyword djangoFilter contained time timesince timeuntil title truncatechars |
2034 | 49 syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode |
798 | 50 syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno |
51 | |
1123 | 52 " Keywords to highlight within comments |
53 syn keyword djangoTodo contained TODO FIXME XXX | |
54 | |
798 | 55 " Django template constants (always surrounded by double quotes) |
56 syn region djangoArgument contained start=/"/ skip=/\\"/ end=/"/ | |
57 | |
1123 | 58 " Mark illegal characters within tag and variables blocks |
2200
99ba9a30755a
Various smaller changes. Updated proto files. Updated dependencies.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
59 syn match djangoTagError contained "#}\|{{\|[^%]}}\|[&#]" |
1215 | 60 syn match djangoVarError contained "#}\|{%\|%}\|[<>!&#%]" |
1123 | 61 |
798 | 62 " Django template tag and variable blocks |
1123 | 63 syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display |
64 syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display | |
798 | 65 |
1123 | 66 " Django template 'comment' tag and comment block |
6091
7090d7f160f7
Update runtime files. Add vroom file support.
Bram Moolenaar <bram@vim.org>
parents:
3465
diff
changeset
|
67 syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomment\s*%}" contains=djangoTodo |
1123 | 68 syn region djangoComBlock start="{#" end="#}" contains=djangoTodo |
798 | 69 |
70 " Define the default highlighting. | |
71 " For version 5.7 and earlier: only when not done already | |
72 " For version 5.8 and later: only when an item doesn't have highlighting yet | |
73 if version >= 508 || !exists("did_django_syn_inits") | |
74 if version < 508 | |
75 let did_django_syn_inits = 1 | |
76 command -nargs=+ HiLink hi link <args> | |
77 else | |
78 command -nargs=+ HiLink hi def link <args> | |
79 endif | |
80 | |
81 HiLink djangoTagBlock PreProc | |
82 HiLink djangoVarBlock PreProc | |
83 HiLink djangoStatement Statement | |
84 HiLink djangoFilter Identifier | |
85 HiLink djangoArgument Constant | |
1123 | 86 HiLink djangoTagError Error |
87 HiLink djangoVarError Error | |
88 HiLink djangoError Error | |
798 | 89 HiLink djangoComment Comment |
1123 | 90 HiLink djangoComBlock Comment |
91 HiLink djangoTodo Todo | |
798 | 92 |
93 delcommand HiLink | |
94 endif | |
95 | |
96 let b:current_syntax = "django" |