diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index cb953f9d0c..1cc81b177f 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -735,6 +735,8 @@ function M.html(_, bufnr) ) then return 'htmldjango' + elseif findany(line, { '' }) then + return 'superhtml' end end return 'html' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 83aff0205b..4daa321ec7 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1598,6 +1598,38 @@ func Test_html_file() call assert_equal('htmldjango', &filetype) bwipe! + " Super html layout + let content = ['', + \ '', + \ '', + \ '
', + \ '
'] + call writefile(content, 'Xfile.shtml', 'D') + split Xfile.shtml + call assert_equal('superhtml', &filetype) + bwipe! + + " Super html template + let content = ['', + \ '', + \ ' ', + \ ' ', + \ ' <super>', + \ ' suffix', + \ ' ', + \ ' ', + \ ' ', + \ ' ', + \ '
', + \ ' ', + \ '
', + \ ' ', + \ ''] + call writefile(content, 'Xfile.shtml', 'D') + split Xfile.shtml + call assert_equal('superhtml', &filetype) + bwipe! + " regular HTML let content = ['', '', ' Foobar', ' Content', ' ', ''] call writefile(content, 'Xfile.html', 'D')