jonsmithers / vim-html-template-literals

Syntax highlighting for html template literals in javascript (as in lit-html and polymer 3)
MIT License
71 stars 10 forks source link
javascript js lit-element lit-html litelement polymer-3 syntax-highlighting tagged-template-literals template-literals vim

HTML Template Literals

Syntax highlighting and indentation for html inside of tagged template literals, as seen in lit-html and Polymer 3.

Supported Syntaxes inside html`...`

See Configuration for support for css tagged literals (css`...`).

Installation

This plugin requires vim-javascript (or typescript-vim if you're using typescript). If you use vim-plug for package management, installation looks like this:

Plug 'jonsmithers/vim-html-template-literals'
Plug 'pangloss/vim-javascript'

NOTE: it's generally a good idea to have let g:html_indent_style1 = "inc" in your vimrc for reasonable indentation of <style> tags. See :help html-indenting.

Configuration

Flag Description
g:htl_css_templates Enable css syntax inside css-tagged template literals (css`...`). Indentation behavior is currently not implemented.
g:htl_all_templates (Experimental) Enable html syntax inside all template literals (`...`).
g:htl_tag_names (Experimental) Specify the tag names in which to enable html syntax highlighting (default ['html']).

Known Issues

Tips