/vim/bundle/Vim-R-plugin/syntax/rdoc.vim

https://github.com/evan2m/dotfiles · Vim Script · 50 lines · 34 code · 10 blank · 6 comment · 3 complexity · 7d52eb2f5847229c38489bebb3713d35 MD5 · raw file

  1. " Vim syntax file
  2. " Language: Test version of R documentation
  3. " Maintainer: Jakson A. Aquino <jalvesaq@gmail.com>
  4. if exists("b:current_syntax")
  5. finish
  6. endif
  7. if !exists("rdoc_minlines")
  8. let rdoc_minlines = 200
  9. endif
  10. if !exists("rdoc_maxlines")
  11. let rdoc_maxlines = 2 * rdoc_minlines
  12. endif
  13. exec "syn sync minlines=" . rdoc_minlines . " maxlines=" . rdoc_maxlines
  14. syn match rdocTitle "^[A-Z].*:"
  15. syn match rdocTitle "^\S.*R Documentation$"
  16. syn region rdocStringS start="‘" end="’"
  17. syn region rdocStringS start="‘" end="’"
  18. syn region rdocStringD start='"' skip='\\"' end='"'
  19. syn match rdocURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]`
  20. syn keyword rdocNote note Note NOTE note: Note: NOTE: Notes Notes:
  21. syn match rdocArg "^\s*\([a-z]\|[A-Z]\|[0-9]\|\.\)*: "
  22. syn include @rdocR syntax/r.vim
  23. syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend
  24. " When using vim as R pager to see the output of help.search():
  25. syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName,rdocFuncName transparent
  26. syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained
  27. syn match rdocFuncName "::[A-Za-z0-9\.\-]*" contained
  28. " Define the default highlighting.
  29. hi def link rdocTitle Title
  30. hi def link rdocExTitle Title
  31. hi def link rdocExEnd Comment
  32. hi def link rdocStringS Function
  33. hi def link rdocStringD String
  34. hi def link rdocURL HtmlLink
  35. hi def link rdocArg Special
  36. hi def link rdocNote Todo
  37. hi def link rdocPackName Title
  38. hi def link rdocFuncName Function
  39. let b:current_syntax = "rdoc"
  40. " vim:ts=8 sts=2 sw=2: