rst.vim 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. " reStructuredText filetype plugin file
  2. " Language: reStructuredText documentation format
  3. " Maintainer: Marshall Ward <marshall.ward@gmail.com>
  4. " Original Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Website: https://github.com/marshallward/vim-restructuredtext
  6. " Latest Revision: 2020-03-31
  7. if exists("b:did_ftplugin")
  8. finish
  9. endif
  10. let b:did_ftplugin = 1
  11. let s:cpo_save = &cpo
  12. set cpo&vim
  13. "Disable folding
  14. if !exists('g:rst_fold_enabled')
  15. let g:rst_fold_enabled = 0
  16. endif
  17. let b:undo_ftplugin = "setl com< cms< et< fo<"
  18. setlocal comments=fb:.. commentstring=..\ %s expandtab
  19. setlocal formatoptions+=tcroql
  20. " reStructuredText standard recommends that tabs be expanded to 8 spaces
  21. " The choice of 3-space indentation is to provide slightly better support for
  22. " directives (..) and ordered lists (1.), although it can cause problems for
  23. " many other cases.
  24. "
  25. " More sophisticated indentation rules should be revisted in the future.
  26. if exists("g:rst_style") && g:rst_style != 0
  27. setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
  28. endif
  29. if g:rst_fold_enabled != 0 && has('patch-7.3.867') " Introduced the TextChanged event.
  30. setlocal foldmethod=expr
  31. setlocal foldexpr=RstFold#GetRstFold()
  32. setlocal foldtext=RstFold#GetRstFoldText()
  33. augroup RstFold
  34. autocmd TextChanged,InsertLeave <buffer> unlet! b:RstFoldCache
  35. augroup END
  36. endif
  37. let &cpo = s:cpo_save
  38. unlet s:cpo_save