Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / vim / vim74 / indent / | server ip : 172.67.156.115 your ip : 172.71.254.239 H O M E |
Filename | /usr/share/vim/vim74/indent/liquid.vim |
Size | 1.83 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 03-Jan-2014 03:40 |
Last accessed | 06-Jul-2025 12:47 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
" Vim indent file
" Language: Liquid
" Maintainer: Tim Pope <[email protected]>
" Last Change: 2013 May 30
if exists('b:did_indent')
finish
endif
set indentexpr=
if exists('b:liquid_subtype')
exe 'runtime! indent/'.b:liquid_subtype.'.vim'
else
runtime! indent/html.vim
endif
unlet! b:did_indent
if &l:indentexpr == ''
if &l:cindent
let &l:indentexpr = 'cindent(v:lnum)'
else
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
endif
endif
let b:liquid_subtype_indentexpr = &l:indentexpr
let b:did_indent = 1
setlocal indentexpr=GetLiquidIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty
" Only define the function once.
if exists('*GetLiquidIndent')
finish
endif
function! s:count(string,pattern)
let string = substitute(a:string,'\C'.a:pattern,"\n",'g')
return strlen(substitute(string,"[^\n]",'','g'))
endfunction
function! GetLiquidIndent(...)
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
let v:lnum = a:1
endif
let vcol = col('.')
call cursor(v:lnum,1)
exe "let ind = ".b:liquid_subtype_indentexpr
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
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*$')
return ind
endfunction
" Language: Liquid
" Maintainer: Tim Pope <[email protected]>
" Last Change: 2013 May 30
if exists('b:did_indent')
finish
endif
set indentexpr=
if exists('b:liquid_subtype')
exe 'runtime! indent/'.b:liquid_subtype.'.vim'
else
runtime! indent/html.vim
endif
unlet! b:did_indent
if &l:indentexpr == ''
if &l:cindent
let &l:indentexpr = 'cindent(v:lnum)'
else
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
endif
endif
let b:liquid_subtype_indentexpr = &l:indentexpr
let b:did_indent = 1
setlocal indentexpr=GetLiquidIndent()
setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty
" Only define the function once.
if exists('*GetLiquidIndent')
finish
endif
function! s:count(string,pattern)
let string = substitute(a:string,'\C'.a:pattern,"\n",'g')
return strlen(substitute(string,"[^\n]",'','g'))
endfunction
function! GetLiquidIndent(...)
if a:0 && a:1 == '.'
let v:lnum = line('.')
elseif a:0 && a:1 =~ '^\d'
let v:lnum = a:1
endif
let vcol = col('.')
call cursor(v:lnum,1)
exe "let ind = ".b:liquid_subtype_indentexpr
let lnum = prevnonblank(v:lnum-1)
let line = getline(lnum)
let cline = getline(v:lnum)
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*$')
return ind
endfunction