blob: 29fa5bc78faa4a086d576e73ed97d3ef94e3db9a [file] [log] [blame]
Bram Moolenaardb6ea062014-07-10 22:01:47 +02001" Vim indent file
2" Language: Rnoweb
3" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
Bram Moolenaar77cdfd12016-03-12 12:57:59 +01004" Homepage: https://github.com/jalvesaq/R-Vim-runtime
5" Last Change: Tue Apr 07, 2015 04:38PM
Bram Moolenaardb6ea062014-07-10 22:01:47 +02006
7
8" Only load this indent file when no other was loaded.
9if exists("b:did_indent")
10 finish
11endif
12runtime indent/tex.vim
13let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
14unlet b:did_indent
15runtime indent/r.vim
16let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
17let b:did_indent = 1
18
19setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
20setlocal indentexpr=GetRnowebIndent()
21
22if exists("*GetRnowebIndent")
23 finish
24endif
25
26function GetRnowebIndent()
Bram Moolenaar541f92d2015-06-19 13:27:23 +020027 let curline = getline(".")
28 if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
Bram Moolenaardb6ea062014-07-10 22:01:47 +020029 return 0
30 endif
31 if search("^<<", "bncW") > search("^@", "bncW")
32 return s:RIndent()
33 endif
34 return s:TeXIndent()
35endfunction
36
37" vim: sw=2