1" Vim indent file 2" Language: Rnoweb 3" Author: Jakson Alves de Aquino <[email protected]> 4" Homepage: https://github.com/jalvesaq/R-Vim-runtime 5" Last Change: Fri Apr 15, 2016 10:58PM 6 7 8" Only load this indent file when no other was loaded. 9if exists("b:did_indent") 10 finish 11endif 12runtime indent/tex.vim 13 14function! s:NoTeXIndent() 15 return indent(line(".")) 16endfunction 17 18if &indentexpr == "" || &indentexpr == "GetRnowebIndent()" 19 let s:TeXIndent = function("s:NoTeXIndent") 20else 21 let s:TeXIndent = function(substitute(&indentexpr, "()", "", "")) 22endif 23 24unlet! b:did_indent 25runtime indent/r.vim 26let s:RIndent = function(substitute(&indentexpr, "()", "", "")) 27let b:did_indent = 1 28 29setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item 30setlocal indentexpr=GetRnowebIndent() 31 32if exists("*GetRnowebIndent") 33 finish 34endif 35 36function GetRnowebIndent() 37 let curline = getline(".") 38 if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$' 39 return 0 40 endif 41 if search("^<<", "bncW") > search("^@", "bncW") 42 return s:RIndent() 43 endif 44 return s:TeXIndent() 45endfunction 46 47" vim: sw=2 48