Skip to content

Commit 5ffb23c

Browse files
dkearnschrisbra
authored andcommitted
runtime(rst): Update b:undo_ftplugin variable
The value of this variable is evaluated when the 'filetype' option is changed and should be a command string that will undo any configuration changes that the plugin has made. See :help undo_indent for details related: #18566 Signed-off-by: Doug Kearns <[email protected]> Signed-off-by: Marshall Ward <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 46d8697 commit 5ffb23c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

runtime/ftplugin/rst.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
" Original Maintainer: Nikolai Weibull <[email protected]>
55
" Website: https://github.com/marshallward/vim-restructuredtext
66
" Latest Revision: 2020-03-31
7+
" 2025 Oct 13 by Vim project: update b:undo_ftplugin #18566
78

89
if exists("b:did_ftplugin")
910
finish
@@ -18,7 +19,7 @@ if !exists('g:rst_fold_enabled')
1819
let g:rst_fold_enabled = 0
1920
endif
2021

21-
let b:undo_ftplugin = "setl com< cms< et< fo<"
22+
let b:undo_ftplugin = "setlocal comments< commentstring< expandtab< formatoptions<"
2223

2324
setlocal comments=fb:.. commentstring=..\ %s expandtab
2425
setlocal formatoptions+=tcroql
@@ -32,15 +33,17 @@ setlocal formatoptions+=tcroql
3233

3334
if exists("g:rst_style") && g:rst_style != 0
3435
setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8
36+
let b:undo_ftplugin .= " | setlocal softtabstop< shiftwidth< tabstop<"
3537
endif
3638

37-
if g:rst_fold_enabled != 0 && has('patch-7.3.867') " Introduced the TextChanged event.
39+
if g:rst_fold_enabled != 0
3840
setlocal foldmethod=expr
3941
setlocal foldexpr=RstFold#GetRstFold()
4042
setlocal foldtext=RstFold#GetRstFoldText()
4143
augroup RstFold
4244
autocmd TextChanged,InsertLeave <buffer> unlet! b:RstFoldCache
4345
augroup END
46+
let b:undo_ftplugin .= " | setlocal foldexpr< foldmethod< foldtext<"
4447
endif
4548

4649
let &cpo = s:cpo_save

0 commit comments

Comments
 (0)