robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
9ebf3454ad
master
1" Vim filetype plugin 2" Language: HLS/M3U Playlist 3" Maintainer: AvidSeeker <avidseeker7@protonmail.com> 4" Last Change: 2024 Jul 07 5" 6 7if exists ( "b:did_ftplugin" ) 8finish 9endif 10let g: did_ftplugin = 1 11 12setlocal commentstring = #%s 13 14let b: undo_ftplugin = "setl commentstring<" 15 16function ! M3UFold () abort 17let line = getline ( v: lnum ) 18if line =~# '^#EXTGRP' 19return ">1" 20endif 21return "=" 22endfunction 23 24function ! M3UFoldText () abort 25let start_line = getline ( v: foldstart ) 26let title = substitute ( start_line , '^#EXTGRP:*' , '' , '' ) 27let foldsize = ( v: foldend - v: foldstart + 1 ) 28let linecount = '[' . foldsize . ' lines]' 29return title . ' ' . linecount 30endfunction 31 32if has ( "folding" ) 33setlocal foldexpr = M3UFold () 34setlocal foldmethod = expr 35setlocal foldtext = M3UFoldText () 36let b: undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<" 37endif