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 | 77cdfd1 | 2016-03-12 12:57:59 +0100 | [diff] [blame] | 4 | " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
| 5 | " Last Change: Tue Apr 07, 2015 04:38PM |
Bram Moolenaar | db6ea06 | 2014-07-10 22:01:47 +0200 | [diff] [blame] | 6 | |
| 7 | |
| 8 | " Only load this indent file when no other was loaded. |
| 9 | if exists("b:did_indent") |
| 10 | finish |
| 11 | endif |
| 12 | runtime indent/tex.vim |
| 13 | let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) |
| 14 | unlet b:did_indent |
| 15 | runtime indent/r.vim |
| 16 | let s:RIndent = function(substitute(&indentexpr, "()", "", "")) |
| 17 | let b:did_indent = 1 |
| 18 | |
| 19 | setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item |
| 20 | setlocal indentexpr=GetRnowebIndent() |
| 21 | |
| 22 | if exists("*GetRnowebIndent") |
| 23 | finish |
| 24 | endif |
| 25 | |
| 26 | function GetRnowebIndent() |
Bram Moolenaar | 541f92d | 2015-06-19 13:27:23 +0200 | [diff] [blame] | 27 | let curline = getline(".") |
| 28 | if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$' |
Bram Moolenaar | db6ea06 | 2014-07-10 22:01:47 +0200 | [diff] [blame] | 29 | return 0 |
| 30 | endif |
| 31 | if search("^<<", "bncW") > search("^@", "bncW") |
| 32 | return s:RIndent() |
| 33 | endif |
| 34 | return s:TeXIndent() |
| 35 | endfunction |
| 36 | |
| 37 | " vim: sw=2 |