In the following go code:
var rootTemplate = template.Must(template.New("root").Parse(`
<!DOCTYPE html>
<html>
<head>
/SNIP/
</html>
`))
I am able to make the html part highlighted as html with this function:
function! GoHtml()
if !empty(b:current_syntax)
unlet b:current_syntax
endif
syn include @html syntax/html.vim
syntax region htmlCode start=+<!DOCTYPE+ keepend end=+</html>+ contains=@html containedIn=goRawString contained
endfunction
autocmd BufEnter *.go call GoHtml()
However after I saved the document, the html syntax highlighting disappears when calling GoImports: let g:go_fmt_command = "GoImports"
Is there a way to keep embeeded html highlighted?