# Vim syntax highlighting for Hugo HTML templates

**URL:** <https://discourse.gohugo.io/t/vim-syntax-highlighting-for-hugo-html-templates/19398>\
**Category:** support\
**Created:** [June 28, 2019, 12:53am UTC](https://discourse.gohugo.io/t/vim-syntax-highlighting-for-hugo-html-templates/19398 "2019-06-28T00:53:35Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Grob](https://avatars.discourse-cdn.com/v4/letter/g/f14d63/32.png) [@Grob](https://discourse.gohugo.io/u/Grob)\
**Post date:** [June 29, 2019, 9:07am UTC](https://discourse.gohugo.io/t/vim-syntax-highlighting-for-hugo-html-templates/19398/8 "2019-06-29T09:07:05Z")

</div>

Just as a side note:

As I only need the _syntax_ and _indentation_ for gohtmltmpl from [vim-go](https://github.com/fatih/vim-go) (just two files) I use this simple script to detect the filetype:

```auto
function DetectGoHtmlTmpl()
    if expand('%:e') == "html" && search("{{") != 0
        set filetype=gohtmltmpl 
    endif
endfunction

augroup filetypedetect
    au! BufRead,BufNewFile * call DetectGoHtmlTmpl()
augroup END

```

Checks if file extension is html and if file contains search term `{{`

Maybe someone can use this.

---

_[View the full topic](https://discourse.gohugo.io/t/vim-syntax-highlighting-for-hugo-html-templates/19398)._
