robin/laufey

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

zeertzjqvim-patch:becf184: runtime(misc): removing saccarosium from maintainer list (#35740)c7a9404019

master
2.0 KiB68 linesraw
1" Vim filetype plugin file
2" Original Author: Maxim Kim <habamax@gmail.com>
3" Previous Maintainer:  Luca Saccarola <github.e41mv@aleeas.com>
4" Maintainer:      This runtime file is looking for a new maintainer.
5" Language:        asciidoc
6" Last Change:     2025 Aug 05
7
8if exists("b:did_ftplugin")
9    finish
10endif
11let b:did_ftplugin = 1
12
13if exists('b:undo_ftplugin')
14    let b:undo_ftplugin .= "|setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<"
15else
16    let b:undo_ftplugin = "setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<"
17endif
18
19" gf to open include::file.ext[] and link:file.ext[] files
20setlocal includeexpr=substitute(v:fname,'\\(link:\\\|include::\\)\\(.\\{-}\\)\\[.*','\\2','g')
21
22setlocal comments=
23setlocal commentstring=//\ %s
24
25setlocal formatoptions+=cqn
26setlocal formatlistpat=^\\s*[\\[({]\\?\\([0-9]\\+
27setlocal formatlistpat+=\\\|[a-zA-Z]\\)[\\]:.)}]\\s\\+
28setlocal formatlistpat+=\\\|^\\s*-\\s\\+
29setlocal formatlistpat+=\\\|^\\s*[*]\\+\\s\\+
30setlocal formatlistpat+=\\\|^\\s*[.]\\+\\s\\+
31
32function AsciidocFold()
33    let line = getline(v:lnum)
34
35    if (v:lnum == 1) && (line =~ '^----*$')
36       return ">1"
37    endif
38
39    let nested = get(g:, "asciidoc_foldnested", 1)
40
41    " Regular headers
42    let depth = match(line, '\(^=\+\)\@<=\( .*$\)\@=')
43
44    " Do not fold nested regular headers
45    if depth > 1 && !nested
46        let depth = 1
47    endif
48
49    if depth > 0
50        " fold all sections under title
51        if depth > 1 && !get(g:, "asciidoc_fold_under_title", 1)
52            let depth -= 1
53        endif
54        " check syntax, it should be asciidocTitle or asciidocH
55        let syncode = synstack(v:lnum, 1)
56        if len(syncode) > 0 && synIDattr(syncode[0], 'name') =~ 'asciidoc\%(H[1-6]\)\|Title'
57            return ">" . depth
58        endif
59    endif
60
61    return "="
62endfunction
63
64if has("folding") && get(g:, 'asciidoc_folding', 0)
65    setlocal foldexpr=AsciidocFold()
66    setlocal foldmethod=expr
67    let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
68endif