blob: c88e8f258084be4fd59afb5af45430dbbb5f051f [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 Moolenaard1caa942020-04-10 22:10:56 +02006" Latest Revision: 2020-03-31
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"
Viktor Szépe3fc7a7e2023-08-23 21:20:00 +020031" More sophisticated indentation rules should be revisited in the future.
Bram Moolenaar91f84f62018-07-29 15:07:52 +020032
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
Bram Moolenaard1caa942020-04-10 22:10:56 +020037if g:rst_fold_enabled != 0 && has('patch-7.3.867') " Introduced the TextChanged event.
Bram Moolenaar91f84f62018-07-29 15:07:52 +020038 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