robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
0bb2f5cc08
master
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' ) 8finish 9endif 10 11if ! exists ( 'g:liquid_default_subtype' ) 12let g: liquid_default_subtype = 'html' 13endif 14 15if ! exists ( 'b:liquid_subtype' ) 16let s: lines = getline ( 1 ) . "\n" . getline ( 2 ) . "\n" . getline ( 3 ) . "\n" . getline ( 4 ) . "\n" . getline ( 5 ) . "\n" . getline ( "$" ) 17let b: liquid_subtype = matchstr ( s: lines , 'liquid_subtype=\zs\w\+' ) 18if b: liquid_subtype == '' 19let b: liquid_subtype = matchstr ( & filetype , '^liquid\.\zs\w\+' ) 20endif 21if b: liquid_subtype == '' 22let b: liquid_subtype = matchstr ( substitute ( expand ( '%:t' ), '\c\%(\.liquid\)\+$' , '' , '' ), '\.\zs\w\+$' ) 23endif 24if b: liquid_subtype == '' 25let b: liquid_subtype = g: liquid_default_subtype 26endif 27endif 28 29if exists ( 'b:liquid_subtype' ) && b: liquid_subtype != '' 30exe 'runtime! ftplugin/' . b: liquid_subtype . '[.]{vim,lua} ftplugin/' . b: liquid_subtype . '_*.{vim,lua} ftplugin/' . b: liquid_subtype . '/*.{vim,lua}' 31else 32runtime ! ftplugin/html[.]{vim,lua} ftplugin/html_*.{vim,lua} ftplugin/html/*.{vim,lua} 33endif 34let b: did_ftplugin = 1 35 36if exists ( 'b:undo_ftplugin' ) 37let b: undo_ftplugin .= '|' 38else 39let b: undo_ftplugin = '' 40endif 41if exists ( 'b:browsefilter' ) 42let b: browsefilter = "\n" . b: browsefilter 43else 44let b: browsefilter = '' 45endif 46if exists ( 'b:match_words' ) 47let b: match_words .= ',' 48elseif exists ( 'loaded_matchit' ) 49let b: match_words = '' 50endif 51 52if has ( 'gui_win32' ) 53let b: browsefilter = "Liquid Files (*.liquid)\t*.liquid" . b: browsefilter 54endif 55 56if exists ( 'loaded_matchit' ) 57let 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'