From 5e0cce4f760b46c10ab285328533a2908e02153d Mon Sep 17 00:00:00 2001 From: Eloy Espinaco Date: Sat, 27 Nov 2021 01:31:37 -0300 Subject: [PATCH 1/3] Add missing sections folder for shopify Use a single file-pattern to match multiple folders. --- ftdetect/liquid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftdetect/liquid.vim b/ftdetect/liquid.vim index 5e8efce..a0d7434 100644 --- a/ftdetect/liquid.vim +++ b/ftdetect/liquid.vim @@ -11,6 +11,6 @@ au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md \ endif " Set subtype for Shopify alternate templates -au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid +au BufNewFile,BufRead */{templates,layout,snippets,sections}/**.liquid \ let b:liquid_subtype = 'html' | \ set ft=liquid | From e637b517f461225ede58ba65951909a3c3968154 Mon Sep 17 00:00:00 2001 From: Eloy Espinaco Date: Tue, 9 Nov 2021 18:22:24 -0300 Subject: [PATCH 2/3] Add shopify specific style and schema tags Implement the changes from #16 to have JSON syntax highlighting on [section schema][1] and CSS highlighting on the [style][2] tag. [1]: https://shopify.dev/themes/architecture/sections/section-schema [2]: https://shopify.dev/api/liquid/tags/theme-tags#style --- syntax/liquid.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/syntax/liquid.vim b/syntax/liquid.vim index 67ac01d..9b755e7 100644 --- a/syntax/liquid.vim +++ b/syntax/liquid.vim @@ -73,6 +73,15 @@ syn region liquidExpression matchgroup=liquidDelimiter start="{{-\=" end="-\=}} syn region liquidComment matchgroup=liquidDelimiter start="{%-\=\s*comment\s*-\=%}" end="{%-\=\s*endcomment\s*-\=%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend syn region liquidRaw matchgroup=liquidDelimiter start="{%-\=\s*raw\s*-\=%}" end="{%-\=\s*endraw\s*-\=%}" contains=TOP,@liquidExempt containedin=ALLBUT,@liquidExempt keepend +if exists('b:liquid_subtype') && b:liquid_subtype ==# 'html' + syn include @JSON syntax/json.vim + unlet! b:current_syntax + syn include @CSS syntax/css.vim + unlet! b:current_syntax + syn region liquidJson matchgroup=liquidDelimiter start="{%\s*schema\s*%}" end="{%\s*endschema\s*%}" contains=@JSON keepend + syn region liquidCss matchgroup=liquidDelimiter start="{%\s*style\s*%}" end="{%\s*endstyle\s*%}" contains=@CSS keepend +end + syn cluster liquidExempt contains=liquidStatement,liquidExpression,liquidComment,liquidRaw,@liquidStatement,liquidYamlHead syn cluster liquidStatement contains=liquidConditional,liquidRepeat,liquidKeyword,@liquidExpression syn cluster liquidExpression contains=liquidOperator,liquidString,liquidNumber,liquidFloat,liquidBoolean,liquidNull,liquidEmpty,liquidPipe,liquidForloop From 3dc768e3e20b3cfcdf04fc3527ddb28cc94f0e81 Mon Sep 17 00:00:00 2001 From: Eloy Espinaco Date: Sun, 28 Nov 2021 22:28:25 -0300 Subject: [PATCH 3/3] Add matchit rules for style and schema tags --- ftplugin/liquid.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/liquid.vim b/ftplugin/liquid.vim index a6d20c5..cbc3bdd 100644 --- a/ftplugin/liquid.vim +++ b/ftplugin/liquid.vim @@ -53,7 +53,7 @@ if has('gui_win32') endif if exists('loaded_matchit') - let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\,\<\(capture\|comment\|highlight\)\>:\' + let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\,\<\(capture\|comment\|highlight\|schema\|style\)\>:\' endif setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}