summaryrefslogtreecommitdiffstats
path: root/syntax/htmldjango.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-09-24 10:50:19 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-09-24 10:50:19 +0200
commite2bbed8acc1f1cf498a0085cf771cf9bf40fb709 (patch)
tree001f4955c399ac71b34fa38f2a3bd63526df50d6 /syntax/htmldjango.vim
parent6b4da2753814cc61cd842c589d829f03cd7ca98d (diff)
downloadvim-polyglot-e2bbed8acc1f1cf498a0085cf771cf9bf40fb709.tar.gz
vim-polyglot-e2bbed8acc1f1cf498a0085cf771cf9bf40fb709.zip
Fix django highlighting, fixes #553
Diffstat (limited to 'syntax/htmldjango.vim')
-rw-r--r--syntax/htmldjango.vim30
1 files changed, 30 insertions, 0 deletions
diff --git a/syntax/htmldjango.vim b/syntax/htmldjango.vim
new file mode 100644
index 00000000..0e2c329d
--- /dev/null
+++ b/syntax/htmldjango.vim
@@ -0,0 +1,30 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'htmldjango') == -1
+
+" Vim syntax file
+" Language: Django HTML template
+" Maintainer: Dave Hodder <dmh@dmh.org.uk>
+" Last Change: 2014 Jul 13
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+if !exists("main_syntax")
+ let main_syntax = 'html'
+endif
+
+runtime! syntax/django.vim
+runtime! syntax/html.vim
+unlet b:current_syntax
+
+syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock
+
+syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display containedin=ALLBUT,@djangoBlocks
+syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display containedin=ALLBUT,@djangoBlocks
+syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomment\s*%}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
+syn region djangoComBlock start="{#" end="#}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
+
+let b:current_syntax = "htmldjango"
+
+endif