Skip to content

joukevandermaas/vim-ember-hbs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

vim-ember-hbs

vim-ember-hbs is a plugin to add Ember Handlebars/HTMLBars syntax highlighting and indentation to Vim. It supports modern Ember Handlebars syntax like {{else if and {{#each-in. An example of the highlighting (and indentation):

Badwolf theme Solarized theme

Installation

The easiest way to install vim-ember-hbs is using the amazing Pathogen. Simply copy/paste the following snippet:

cd ~/.vim/bundle
git clone https://github.com/joukevandermaas/vim-ember-hbs.git

Substitute .vim for vimfiles on Windows (in PowerShell).

Customization

The plugin defines a number of match groups that can be configured in a file at $HOME/.vim/after/syntax/handlebars.vim. Those groups and there default highlight links are:

Please open an issue, if you are missing one.

hi link hbsBuiltInHelper Function         " all built in helpers like if, else, textarea, input, etc.
hi link hbsKeyword Keyword                " currently the only keyword supported is `as`
hi link hbsOperator Operator              " pencil () and argument =
hi link hbsDelimiter Delimiter            " the || in e.g. `{{#each foo as |bar|}}`
hi link hbsMustacheName Statement         " the name of a mustache `{{my-name`
hi link hbsPencilName Statement           " the name of a pencil `(my-name`
hi link hbsIdentifier Identifier          " everything thats inside a mustache or a pencil and is not a name nor an arg
hi link hbsString String                  " a "string" inside a mustache or a pencil
hi link hbsNumber Number                  " a 0135 number inside a mustache or a pencil
hi link hbsHandles Define                 " The mustaches handles {{
hi link hbsUnescapedHandles Identifier    " A handle with three braces {{{
hi link hbsUnescapedIdentifier Identifier " The identifier inside those {{{
hi link hbsComment Comment                " A comment {{!-- comment --}}
hi link hbsArg Type                       " An argument inside a mustache or a pencil

One can e.g. highlight all unescaped mustaches as Error with

hi link hbsUnescapedIdentifier Error

To also highlight the {{{ as Error, simply add

hi link hbsUnescapedHandles Error

About

Ember Handlebars/HTMLBars plugin for Vim with indentation support

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published