aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-06-18 20:00:43 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-06-19 00:22:58 +0200
commit6012f79557b8807593c1c88b75e54f14a88d5173 (patch)
tree7fcae242d3f8afc608bced3a0019f54ce8d03ae5 /runtime/lua/vim
parent102971a396724594a00f7e31cbeec55cdb536f17 (diff)
downloadrneovim-6012f79557b8807593c1c88b75e54f14a88d5173.tar.gz
rneovim-6012f79557b8807593c1c88b75e54f14a88d5173.tar.bz2
rneovim-6012f79557b8807593c1c88b75e54f14a88d5173.zip
vim-patch:9718ed7: runtime(filetype): update htmldjango detection
- update tags to detect djangohtml based on https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#built-in-tag-reference - increase the lines to inspect to 40 lines 10 lines is too few and might result in high false negative. Increasing it to 40 lines should reduce the false negative. closes: vim/vim#15037 https://github.com/vim/vim/commit/9718ed7ab989c0a0be88a0d749f24321eb0e6af1 Co-authored-by: Afiq Nazrie <afnazrie@gmail.com>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype/detect.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index fa90c83b81..997b53ba4b 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -676,10 +676,15 @@ end
--- @type vim.filetype.mapfn
function M.html(_, bufnr)
- for _, line in ipairs(getlines(bufnr, 1, 10)) do
+ for _, line in ipairs(getlines(bufnr, 1, 40)) do
if matchregex(line, [[\<DTD\s\+XHTML\s]]) then
return 'xhtml'
- elseif matchregex(line, [[\c{%\s*\(extends\|block\|load\)\>\|{#\s\+]]) then
+ elseif
+ matchregex(
+ line,
+ [[\c{%\s*\(autoescape\|block\|comment\|csrf_token\|cycle\|debug\|extends\|filter\|firstof\|for\|if\|ifchanged\|include\|load\|lorem\|now\|query_string\|regroup\|resetcycle\|spaceless\|templatetag\|url\|verbatim\|widthratio\|with\)\>\|{#\s\+]]
+ )
+ then
return 'htmldjango'
end
end