blob: 45a5e19d49c3a10d7472f2755f076b747de90d5a [file] [log] [blame]
Luca Saccarola06848002024-11-14 22:44:14 +01001" Vim filetype plugin file
2" Language: Org
3" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
4" Last Change: 2024 Nov 14
5
6if exists("b:did_ftplugin")
7 finish
8endif
9let b:did_ftplugin = 1
10
11if exists('b:undo_ftplugin')
12 let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
13else
14 let b:undo_ftplugin = "setl cms< com< fo< flp<"
15endif
16
17setl commentstring=#\ %s
18setl comments=fb:*,fb:-,fb:+,b:#,b:\:
19
20setl formatoptions+=nql
21setl formatlistpat=^\\s*\\(\\(\\d\\|\\a\\)\\+[.)]\\|[+-]\\)\\s\\+
22
23function OrgFoldExpr()
24 let l:depth = match(getline(v:lnum), '\(^\*\+\)\@<=\( .*$\)\@=')
25 if l:depth > 0 && synIDattr(synID(v:lnum, 1, 1), 'name') =~# '\m^orgHeadline'
26 return ">" . l:depth
27 endif
28 return "="
29endfunction
30
31if has("folding") && get(g:, 'org_folding', 0)
32 setl foldexpr=OrgFoldExpr()
33 setl foldmethod=expr
34 let b:undo_ftplugin .= "|setl foldexpr< foldmethod<"
35endif
36
37" vim: ts=8 sts=2 sw=2 et