53

GitHub - joukevandermaas/vim-ember-hbs: Ember Handlebars/HTMLBars plugin for Vim...

 5 years ago
source link: https://github.com/joukevandermaas/vim-ember-hbs
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

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 Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK