2202
|
1 " Vim filetype plugin
|
|
2 " Language: Liquid
|
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
|
4 " Last Change: 2010 May 21
|
|
5
|
|
6 if exists('b:did_ftplugin')
|
|
7 finish
|
|
8 endif
|
|
9
|
|
10 if !exists('g:liquid_default_subtype')
|
|
11 let g:liquid_default_subtype = 'html'
|
|
12 endif
|
|
13
|
|
14 if !exists('b:liquid_subtype')
|
|
15 let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
|
16 let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+')
|
|
17 if b:liquid_subtype == ''
|
|
18 let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+')
|
|
19 endif
|
|
20 if b:liquid_subtype == ''
|
|
21 let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$')
|
|
22 endif
|
|
23 if b:liquid_subtype == ''
|
|
24 let b:liquid_subtype = g:liquid_default_subtype
|
|
25 endif
|
|
26 endif
|
|
27
|
|
28 if exists('b:liquid_subtype') && b:liquid_subtype != ''
|
|
29 exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim'
|
|
30 else
|
|
31 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
|
32 endif
|
|
33 let b:did_ftplugin = 1
|
|
34
|
|
35 if exists('b:undo_ftplugin')
|
|
36 let b:undo_ftplugin .= '|'
|
|
37 else
|
|
38 let b:undo_ftplugin = ''
|
|
39 endif
|
|
40 if exists('b:browsefilter')
|
|
41 let b:browsefilter = "\n".b:browsefilter
|
|
42 else
|
|
43 let b:browsefilter = ''
|
|
44 endif
|
|
45 if exists('b:match_words')
|
|
46 let b:match_words .= ','
|
|
47 elseif exists('loaded_matchit')
|
|
48 let b:match_words = ''
|
|
49 endif
|
|
50
|
|
51 if has('gui_win32')
|
|
52 let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter
|
|
53 endif
|
|
54
|
|
55 if exists('loaded_matchit')
|
|
56 let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,<\(capture\|comment\|highlight\)\>:\<end\1\>'
|
|
57 endif
|
|
58
|
|
59 setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
|
|
60
|
|
61 let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words'
|