Bram Moolenaar | db6ea06 | 2014-07-10 22:01:47 +0200 | [diff] [blame] | 1 | " Vim indent file |
| 2 | " Language: Rnoweb |
| 3 | " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> |
Bram Moolenaar | 541f92d | 2015-06-19 13:27:23 +0200 | [diff] [blame] | 4 | " Last Change: Sun Mar 22, 2015 09:28AM |
Bram Moolenaar | db6ea06 | 2014-07-10 22:01:47 +0200 | [diff] [blame] | 5 | |
| 6 | |
| 7 | " Only load this indent file when no other was loaded. |
| 8 | if exists("b:did_indent") |
| 9 | finish |
| 10 | endif |
| 11 | runtime indent/tex.vim |
| 12 | let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) |
| 13 | unlet b:did_indent |
| 14 | runtime indent/r.vim |
| 15 | let s:RIndent = function(substitute(&indentexpr, "()", "", "")) |
| 16 | let b:did_indent = 1 |
| 17 | |
| 18 | setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item |
| 19 | setlocal indentexpr=GetRnowebIndent() |
| 20 | |
| 21 | if exists("*GetRnowebIndent") |
| 22 | finish |
| 23 | endif |
| 24 | |
| 25 | function GetRnowebIndent() |
Bram Moolenaar | 541f92d | 2015-06-19 13:27:23 +0200 | [diff] [blame] | 26 | let curline = getline(".") |
| 27 | if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$' |
Bram Moolenaar | db6ea06 | 2014-07-10 22:01:47 +0200 | [diff] [blame] | 28 | return 0 |
| 29 | endif |
| 30 | if search("^<<", "bncW") > search("^@", "bncW") |
| 31 | return s:RIndent() |
| 32 | endif |
| 33 | return s:TeXIndent() |
| 34 | endfunction |
| 35 | |
| 36 | " vim: sw=2 |