Skip to content

Instantly share code, notes, and snippets.

@schickm
Created September 9, 2018 12:10
Show Gist options
  • Save schickm/ff9ecfdc01ca350b72ba32f80e39c28e to your computer and use it in GitHub Desktop.
Save schickm/ff9ecfdc01ca350b72ba32f80e39c28e to your computer and use it in GitHub Desktop.
# Detection
# ---------
hook global BufCreate .*\.(hbs) %{
set buffer filetype handlebars
}
# Highlighters
# ------------
add-highlighter shared/handlebars-file regions
add-highlighter shared/handlebars-file/html default-region ref html
add-highlighter shared/handlebars regions
add-highlighter shared/handlebars/comment region '\{\{!--' '\}\}' fill comment
add-highlighter shared/handlebars/expression region '\{\{' '\}\}' fill identifier
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group handlebars-highlight global WinSetOption filetype=handlebars %{
add-highlighter shared/html/handlebars region '\{\{' '\}\}' ref handlebars
add-highlighter shared/html/tag/handlebars region '\{\{' '\}\}' ref handlebars
add-highlighter window/handlebars-file ref handlebars-file
}
hook -group handlebars-highlight global WinSetOption filetype=(?!handlebars).* %{
remove-highlighter shared/html/handlebars
remove-highlighter shared/html/tag/handlebars
remove-highlighter window/handlebars-file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment