blob: f0646e9f366e748a11ccebff8d7ff76f1518eb3c [file] [log] [blame]
Bram Moolenaar91f84f62018-07-29 15:07:52 +02001" 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
Bram Moolenaar4c05fa02019-01-01 15:32:17 +01006" Latest Revision: 2018-12-29
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
Bram Moolenaar071d4272004-06-13 20:20:40 +00008if exists("b:did_ftplugin")
Bram Moolenaar91f84f62018-07-29 15:07:52 +02009 finish
Bram Moolenaar071d4272004-06-13 20:20:40 +000010endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000011let b:did_ftplugin = 1
12
Bram Moolenaare37d50a2008-08-06 17:06:04 +000013let s:cpo_save = &cpo
14set cpo&vim
15
Bram Moolenaar4c05fa02019-01-01 15:32:17 +010016"Disable folding
17if !exists('g:rst_fold_enabled')
18 let g:rst_fold_enabled = 0
19endif
20
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000021let b:undo_ftplugin = "setl com< cms< et< fo<"
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
Bram Moolenaar42eeac32005-06-29 22:40:58 +000023setlocal comments=fb:.. commentstring=..\ %s expandtab
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000024setlocal formatoptions+=tcroql
Bram Moolenaare37d50a2008-08-06 17:06:04 +000025
Bram Moolenaar91f84f62018-07-29 15:07:52 +020026" reStructuredText standard recommends that tabs be expanded to 8 spaces
27" The choice of 3-space indentation is to provide slightly better support for
28" directives (..) and ordered lists (1.), although it can cause problems for
29" many other cases.
30"
31" More sophisticated indentation rules should be revisted in the future.
32
Bram Moolenaar4c92e752019-02-17 21:18:32 +010033if exists("g:rst_style") && g:rst_style != 0
Bram Moolenaar91f84f62018-07-29 15:07:52 +020034 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
35endif
36
37if has('patch-7.3.867') " Introduced the TextChanged event.
38 setlocal foldmethod=expr
39 setlocal foldexpr=RstFold#GetRstFold()
40 setlocal foldtext=RstFold#GetRstFoldText()
41 augroup RstFold
42 autocmd TextChanged,InsertLeave <buffer> unlet! b:RstFoldCache
43 augroup END
44endif
45
Bram Moolenaare37d50a2008-08-06 17:06:04 +000046let &cpo = s:cpo_save
47unlet s:cpo_save