robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Barrett Ruthfix(ftplugin): source inherited Lua ftplugins0bb2f5cc08

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