Snippets for Hugo's Go templates.
Heavily inspired by regisphilibert/Sublime-Hugo-Snippets
- Either copy the content of
snippets/hugo-snippets.cson
and paste it into your Atom snippets file (See the Atom flight manual for further information). - Or clone this repository,
cd
into it and link it to your local Atom packages folder withapm link
.
Use "HTML (Go)" as a language type.
Snippet | Tab trigger | Output |
---|---|---|
Curlies | x | {{ }} |
Dot | dot | {{ . }} |
If | if | {{ if }} {{ end }} |
If/Else | ife | {{ if }} {{ else }} {{ end }} |
If/Else if | ifei | {{ if }} {{ else if }} {{ end }} |
With | with | {{ with }} {{ end }} |
With/Else | withe | {{ with }} {{ else }} {{ end }} |
Range | range | {{ range }} {{ end }} |
Partial | partial | {{ partial "" . }} |
Block | block | {{ block "main" . }} {{ end }} |
Block define | define | {{ define "block" }} {{ end }} |
Comment | comment | {{/* */}} |
Variable | var | {{ $var := what }} |
Debug | debug | {{ printf "%#v" }} |