blob: 9d737cde44742262abf66381f1c614882fc98bdc [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
6" Latest Revision: 2018-01-07
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 Moolenaar0dc065e2005-07-04 22:49:24 +000016let b:undo_ftplugin = "setl com< cms< et< fo<"
Bram Moolenaar071d4272004-06-13 20:20:40 +000017
Bram Moolenaar42eeac32005-06-29 22:40:58 +000018setlocal comments=fb:.. commentstring=..\ %s expandtab
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000019setlocal formatoptions+=tcroql
Bram Moolenaare37d50a2008-08-06 17:06:04 +000020
Bram Moolenaar91f84f62018-07-29 15:07:52 +020021" 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
Bram Moolenaare37d50a2008-08-06 17:06:04 +000041let &cpo = s:cpo_save
42unlet s:cpo_save