rnoweb.vim 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. " 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. function s:NoTeXIndent()
  14. return indent(line("."))
  15. endfunction
  16. if &indentexpr == "" || &indentexpr == "GetRnowebIndent()"
  17. let s:TeXIndent = function("s:NoTeXIndent")
  18. else
  19. let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
  20. endif
  21. unlet! b:did_indent
  22. runtime indent/r.vim
  23. let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
  24. let b:did_indent = 1
  25. setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
  26. setlocal indentexpr=GetRnowebIndent()
  27. let b:undo_indent = "setl inde< indk<"
  28. if exists("*GetRnowebIndent")
  29. finish
  30. endif
  31. function GetRnowebIndent()
  32. let curline = getline(".")
  33. if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
  34. return 0
  35. endif
  36. if search("^<<", "bncW") > search("^@", "bncW")
  37. return s:RIndent()
  38. endif
  39. return s:TeXIndent()
  40. endfunction
  41. " vim: sw=2