robin/laufey

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

Christian Clasonvim-patch:ab03dd2: runtime(hlsplaylist): include hlsplaylist ftplugin file9ebf3454ad

master
849 B37 linesraw
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")
8  finish
9endif
10let g:did_ftplugin = 1
11
12setlocal commentstring=#%s
13
14let b:undo_ftplugin = "setl commentstring<"
15
16function! M3UFold() abort
17  let line = getline(v:lnum)
18  if line =~# '^#EXTGRP'
19    return ">1"
20  endif
21  return "="
22endfunction
23
24function! M3UFoldText() abort
25  let start_line = getline(v:foldstart)
26  let title = substitute(start_line, '^#EXTGRP:*', '', '')
27  let foldsize = (v:foldend - v:foldstart + 1)
28  let linecount = '['.foldsize.' lines]'
29  return title.' '.linecount
30endfunction
31
32if has("folding")
33  setlocal foldexpr=M3UFold()
34  setlocal foldmethod=expr
35  setlocal foldtext=M3UFoldText()
36  let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
37endif