runtime(htmldjango): Add syntax highlighting of comparison operators
Commit:
https://github.com/vim/vim/commit/f03155aa2ae2139a82e2b4f9c6ec3501d5e48d53
Author: tecis <[email protected]>
Date: Sun May 17 08:44:39 2026 +0000
runtime(htmldjango): Add syntax highlighting of comparison operators
The presence `djangoOperators` in the file `syntax/django.vim` and
having the highlight function with a `match` statement leads to a
highlight spill-over with other elements defined in `syntax/html.vim`.
To avoid the highlight spill-over declare a region called
`djangoTagBlockNaive` to limit `djangoOperator` to only be matched
within.
related: #20225
closes: #20232
Signed-off-by: tecis <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/htmldjango.vim b/runtime/syntax/htmldjango.vim
index 07b1c375e..bffb11aa6 100644
--- a/runtime/syntax/htmldjango.vim
+++ b/runtime/syntax/htmldjango.vim
@@ -2,6 +2,7 @@
" Language: Django HTML template
" Maintainer: Dave Hodder <[email protected]>
" Last Change: 2014 Jul 13
+" 2026 May 17 by Vim Project Add highlighting for comparison operators #20232
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -23,4 +24,8 @@ syn region djangoVarBlock start="{{" end="}}"
contains=djangoFilter,djangoArgume
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
+" Use djangoTagBlockNaive to limit the djangoOperator matched characters to
avoid spill-over with HTML, JS and CSS.
+syn region djangoTagBlockNaive start="{%" end="%}"
contains=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock
+syn match djangoOperator "==\|!=\|<=\|>=\|<\|>" contained
containedin=CONTAINS,@djangoTagBlockNaive
+
let b:current_syntax = "htmldjango"
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wOXLv-009ILg-OU%40256bit.org.