diff options
Diffstat (limited to '')
-rw-r--r-- | indent/liquid.vim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/indent/liquid.vim b/indent/liquid.vim index 2025dacd..1f12eec5 100644 --- a/indent/liquid.vim +++ b/indent/liquid.vim @@ -56,10 +56,11 @@ function! GetLiquidIndent(...) let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') - let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') - let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') - let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') - let ind -= &sw * s:count(cline,'{%\s*end\w*$') + let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>') + let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') + let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= sw * s:count(cline,'{%\s*end\w*$') return ind endfunction |