robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
9bb046d1be
master
1" Vim indent file 2" Language: Rrst 3" Maintainer: This runtime file is looking for a new maintainer. 4" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> 5" Former Repository: https://github.com/jalvesaq/R-Vim-runtime 6" Last Change: 2023 Feb 25 7" 2024 Feb 19 by Vim Project (announce adoption) 8 9 10" Only load this indent file when no other was loaded. 11if exists ( "b:did_indent" ) 12finish 13endif 14runtime indent/r.vim 15let s: RIndent = function ( substitute ( & indentexpr , "()" , "" , "" )) 16let b: did_indent = 1 17 18setlocal indentkeys = 0{,0},:,!^F,o,O,e 19setlocal indentexpr = GetRrstIndent () 20 21let b: undo_indent = "setl inde< indk<" 22 23if exists ( "*GetRrstIndent" ) 24finish 25endif 26 27function GetRstIndent () 28let pline = getline ( v: lnum - 1 ) 29let cline = getline ( v: lnum ) 30if prevnonblank ( v: lnum - 1 ) < v: lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' 31return indent ( v: lnum ) 32elseif pline =~ '^\s*[-\+\*]\s' 33return indent ( v: lnum - 1 ) + 2 34elseif pline =~ '^\s*\d\+\.\s\+' 35return indent ( v: lnum - 1 ) + 3 36endif 37return indent ( prevnonblank ( v: lnum - 1 )) 38endfunction 39 40function GetRrstIndent () 41if getline ( "." ) =~ '^\.\. {r .*}$' || getline ( "." ) =~ '^\.\. \.\.$' 42return 0 43endif 44if search ( '^\.\. {r' , "bncW" ) > search ( '^\.\. \.\.$' , "bncW" ) 45return s: RIndent () 46else 47return GetRstIndent () 48endif 49endfunction 50 51" vim: sw=2