org.vim 932 B

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