robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:be62259: runtime(rst): set suffixesadd for rst (#37365)a4ee34a165

master
1.6 KiB52 linesraw
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" 2025 Oct 13 by Vim project: update b:undo_ftplugin #18566
8" 2026 Jan 11 by Vim project: set suffixesadd #19149
9
10if exists("b:did_ftplugin")
11    finish
12endif
13let b:did_ftplugin = 1
14
15let s:cpo_save = &cpo
16set cpo&vim
17
18"Disable folding
19if !exists('g:rst_fold_enabled')
20  let g:rst_fold_enabled = 0
21endif
22
23let b:undo_ftplugin = "setlocal comments< commentstring< expandtab< formatoptions< suffixesadd<"
24
25setlocal comments=fb:.. commentstring=..\ %s expandtab
26setlocal formatoptions+=tcroql
27setlocal suffixesadd=.rst
28
29" reStructuredText standard recommends that tabs be expanded to 8 spaces
30" The choice of 3-space indentation is to provide slightly better support for
31" directives (..) and ordered lists (1.), although it can cause problems for
32" many other cases.
33"
34" More sophisticated indentation rules should be revisited in the future.
35
36if exists("g:rst_style") && g:rst_style != 0
37    setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
38    let b:undo_ftplugin .= " | setlocal softtabstop< shiftwidth< tabstop<"
39endif
40
41if g:rst_fold_enabled != 0
42  setlocal foldmethod=expr
43  setlocal foldexpr=RstFold#GetRstFold()
44  setlocal foldtext=RstFold#GetRstFoldText()
45  augroup RstFold
46    autocmd TextChanged,InsertLeave <buffer> unlet! b:RstFoldCache
47  augroup END
48  let b:undo_ftplugin .= " | setlocal foldexpr< foldmethod< foldtext<"
49endif
50
51let &cpo = s:cpo_save
52unlet s:cpo_save