blob: 1bdf7f3b121e84cd3a632b0422cee8e30d3742c7 [file] [log] [blame]
Bram Moolenaardb6ea062014-07-10 22:01:47 +02001" Vim indent file
2" Language: Rnoweb
Christian Brabandtf9ca1392024-02-19 20:37:11 +01003" 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: 2024 Feb 27 07:17PM
7" 2024 Feb 19 by Vim Project (announce adoption)
Bram Moolenaardb6ea062014-07-10 22:01:47 +02008
9
10" Only load this indent file when no other was loaded.
11if exists("b:did_indent")
12 finish
13endif
14runtime indent/tex.vim
Bram Moolenaare4a3bcf2016-08-26 19:52:37 +020015
Bram Moolenaar71badf92023-04-22 22:40:14 +010016function s:NoTeXIndent()
Bram Moolenaare4a3bcf2016-08-26 19:52:37 +020017 return indent(line("."))
18endfunction
19
20if &indentexpr == "" || &indentexpr == "GetRnowebIndent()"
21 let s:TeXIndent = function("s:NoTeXIndent")
22else
23 let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
24endif
25
Bram Moolenaarfc65cab2018-08-28 22:58:02 +020026unlet! b:did_indent
Bram Moolenaardb6ea062014-07-10 22:01:47 +020027runtime indent/r.vim
28let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
29let b:did_indent = 1
30
31setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
32setlocal indentexpr=GetRnowebIndent()
33
Bram Moolenaardd60c362023-02-27 15:49:53 +000034let b:undo_indent = "setl inde< indk<"
35
Bram Moolenaardb6ea062014-07-10 22:01:47 +020036if exists("*GetRnowebIndent")
37 finish
38endif
39
40function GetRnowebIndent()
Bram Moolenaar541f92d2015-06-19 13:27:23 +020041 let curline = getline(".")
42 if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
Bram Moolenaardb6ea062014-07-10 22:01:47 +020043 return 0
44 endif
45 if search("^<<", "bncW") > search("^@", "bncW")
46 return s:RIndent()
47 endif
48 return s:TeXIndent()
49endfunction
50
51" vim: sw=2