This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fd40c0
commit a1518b1
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if has("autocmd") | ||
au BufNewFile,BufRead *.handlebars,*.hbs set filetype=handlebars | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
" Taken from https://github.com/juvenn/mustache.vim/blob/master/ftplugin/mustache.vim | ||
|
||
if exists("loaded_matchit") | ||
let b:match_ignorecase = 0 | ||
|
||
let b:match_words = '{:},[:],(:),' | ||
\ . '\%({{\)\@<=[#^]\s*\([-0-9a-zA-Z_?!/.]\+\)\s*}}' | ||
\ . ':' | ||
\ . '\%({{\)\@<=/\s*\1\s*}}' | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
" Handlebars indent | ||
" Taken from https://github.com/juvenn/mustache.vim/blob/master/indent/mustache.vim | ||
|
||
" Only load this indent file when no other was loaded. | ||
if exists("b:did_indent") | ||
finish | ||
endif | ||
|
||
" Use HTML formatting rules. | ||
runtime! indent/html.vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
" Handlebars syntax | ||
" Language: Handlebars | ||
" Maintainer: Bruno Michel <brmichel@free.fr> | ||
" Last Change: Jun 23th, 2011 | ||
" Version: 0.1 | ||
" URL: https://github.com/nono/vim-handlebars | ||
|
||
|
||
" Read the HTML syntax to start with | ||
if version < 600 | ||
so <sfile>:p:h/html.vim | ||
else | ||
runtime! syntax/html.vim | ||
unlet b:current_syntax | ||
endif | ||
|
||
if version < 600 | ||
syntax clear | ||
elseif exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
" Standard HiLink will not work with included syntax files | ||
if version < 508 | ||
command! -nargs=+ HtmlHiLink hi link <args> | ||
else | ||
command! -nargs=+ HtmlHiLink hi def link <args> | ||
endif | ||
|
||
|
||
syn match hbsError /}}}\?/ | ||
syn match hbsInsideError /{{[{#<>=!\/]\?/ containedin=@hbsInside | ||
|
||
syn cluster htmlHbsContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6 | ||
syn region hbsInside start=/{{/ end=/}}/ keepend transparent containedin=@htmlHbsContainer | ||
|
||
syn match hbsHandlebars "{{\|}}" containedin=hbsInside | ||
syn match hbsUnescape "{{{\|}}}" containedin=hbsInside | ||
syn match hbsOperators "=\|\.\|/" containedin=hbsInside | ||
|
||
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 containedin=hbsInside | ||
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 containedin=hbsInside | ||
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 containedin=hbsInside | ||
|
||
syn region hbsComment start=/!/ end=/}}/me=e-2 containedin=htmlHead contains=Todo | ||
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ containedin=hbsInside | ||
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ containedin=hbsInside | ||
|
||
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" containedin=hbsInside | ||
syn match hbsHelpers "[/#]\(with\|each\)" containedin=hbsInside | ||
|
||
|
||
" Define the default highlighting. | ||
" For version 5.7 and earlier: only when not done already | ||
" For version 5.8 and later: only when an item doesn't have highlighting yet | ||
if version >= 508 || !exists("did_lisp_syntax_inits") | ||
if version < 508 | ||
let did_lisp_syntax_inits = 1 | ||
command -nargs=+ HiLink hi link <args> | ||
else | ||
command -nargs=+ HiLink hi def link <args> | ||
endif | ||
|
||
HtmlHiLink hbsError Error | ||
HtmlHiLink hbsInsideError Error | ||
|
||
HtmlHiLink hbsHandlebars Identifier | ||
HtmlHiLink hbsUnescape Special | ||
HtmlHiLink hbsOperators Operator | ||
|
||
HtmlHiLink hbsConditionals Conditional | ||
HtmlHiLink hbsHelpers Repeat | ||
|
||
HtmlHiLink hbsSection Number | ||
HtmlHiLink hbsPartial Include | ||
HtmlHiLink hbsMarkerSet Number | ||
|
||
HtmlHiLink hbsComment Comment | ||
HtmlHiLink hbsQString String | ||
HtmlHiLink hbsDQString String | ||
|
||
delcommand HiLink | ||
endif | ||
|
||
|
||
let b:current_syntax = 'handlebars' |