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