summaryrefslogtreecommitdiff
path: root/runtime/indent/liquid.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/indent/liquid.vim')
-rw-r--r--runtime/indent/liquid.vim11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim
index 01e722369..f8e1c8307 100644
--- a/runtime/indent/liquid.vim
+++ b/runtime/indent/liquid.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2013 May 30
+" Last Change: 2016 Aug 29
if exists('b:did_indent')
finish
@@ -54,9 +54,10 @@ 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