dotfiles/.vim/pack/plugins/start/vim-hugo/ftdetect/html.vim
2024-12-16 19:13:26 +01:00

17 lines
392 B
VimL

function! s:DetectGoTemplate()
if findfile('.hugo_build.lock', '.;') !=# ''
set ft=htmlhugo
elseif search('{{\s*end\s*}}')
set ft=htmlhugo
elseif search('{{\s*$\k\+\s*:=')
set ft=htmlhugo
elseif search('{{\s*\.[A-Z]')
set ft=htmlhugo
endif
endfunction
augroup DetectGoTemplate
autocmd!
autocmd BufNewFile,BufRead *.html call <SID>DetectGoTemplate()
augroup END