# Vim functions for file type detection
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2026 May 16
+# Last Change: 2026 May 18
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
# These functions are moved here from runtime/filetype.vim to make startup
while n < 40 && n <= line("$")
# Check for Angular
- if getline(n) =~ '@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|ng-template\|ng-content'
+ if getline(n) =~ '@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|\<ng-template\|\<ng-content'
setf htmlangular
return
endif
call assert_equal('htmlangular', &filetype)
bwipe!
+ " HTML Angular ng-template element
+ let content = ['<ng-template let-foo>{{ foo }}</ng-template>']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('htmlangular', &filetype)
+ bwipe!
+
+ " HTML Angular ng-content element
+ let content = ['<div><ng-content select="[item]"></ng-content></div>']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('htmlangular', &filetype)
+ bwipe!
+
+ " Word containing 'ng-template' as a suffix must not trigger htmlangular
+ let content = ['<div class="song-template">', ' <h1>Not Angular</h1>', '</div>']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('html', &filetype)
+ bwipe!
+
" Django Template
let content = ['{% if foobar %}',
\ ' <ul>',