vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

rnoweb.vim (1252B)


      1 " Vim indent file
      2 " Language:	Rnoweb
      3 " 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)
      8 
      9 
     10 " Only load this indent file when no other was loaded.
     11 if exists("b:did_indent")
     12   finish
     13 endif
     14 runtime indent/tex.vim
     15 
     16 function s:NoTeXIndent()
     17   return indent(line("."))
     18 endfunction
     19 
     20 if &indentexpr == "" || &indentexpr == "GetRnowebIndent()"
     21   let s:TeXIndent = function("s:NoTeXIndent")
     22 else
     23   let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
     24 endif
     25 
     26 unlet! b:did_indent
     27 runtime indent/r.vim
     28 let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
     29 let b:did_indent = 1
     30 
     31 setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
     32 setlocal indentexpr=GetRnowebIndent()
     33 
     34 let b:undo_indent = "setl inde< indk<"
     35 
     36 if exists("*GetRnowebIndent")
     37   finish
     38 endif
     39 
     40 function GetRnowebIndent()
     41   let curline = getline(".")
     42   if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
     43     return 0
     44   endif
     45   if search("^<<", "bncW") > search("^@", "bncW")
     46     return s:RIndent()
     47   endif
     48   return s:TeXIndent()
     49 endfunction
     50 
     51 " vim: sw=2