neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

rst.vim (1675B)


      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 
     10 if exists("b:did_ftplugin")
     11    finish
     12 endif
     13 let b:did_ftplugin = 1
     14 
     15 let s:cpo_save = &cpo
     16 set cpo&vim
     17 
     18 "Disable folding
     19 if !exists('g:rst_fold_enabled')
     20  let g:rst_fold_enabled = 0
     21 endif
     22 
     23 let b:undo_ftplugin = "setlocal comments< commentstring< expandtab< formatoptions< suffixesadd<"
     24 
     25 setlocal comments=fb:.. commentstring=..\ %s expandtab
     26 setlocal formatoptions+=tcroql
     27 setlocal 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 
     36 if 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<"
     39 endif
     40 
     41 if 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<"
     49 endif
     50 
     51 let &cpo = s:cpo_save
     52 unlet s:cpo_save