rnoweb.vim 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. " Vim filetype plugin 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 28 by Vim Project
  7. " Only do this when not yet done for this buffer
  8. if exists("b:did_ftplugin")
  9. finish
  10. endif
  11. let s:cpo_save = &cpo
  12. set cpo&vim
  13. runtime! ftplugin/tex.vim
  14. " Don't load another plugin for this buffer
  15. let b:did_ftplugin = 1
  16. " Enables Vim-Latex-Suite, LaTeX-Box if installed
  17. runtime ftplugin/tex_*.vim
  18. setlocal iskeyword=@,48-57,_,.
  19. setlocal suffixesadd=.bib,.tex
  20. setlocal comments=b:%,b:#,b:##,b:###,b:#'
  21. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  22. let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
  23. if has("win32")
  24. let b:browsefilter .= "All Files (*.*)\t*\n"
  25. else
  26. let b:browsefilter .= "All Files (*)\t*\n"
  27. endif
  28. endif
  29. function SetRnwCommentStr()
  30. if (search("^\s*<<.*>>=", "bncW") > search("^@", "bncW"))
  31. set commentstring=#\ %s
  32. else
  33. set commentstring=%\ %s
  34. endif
  35. endfunction
  36. " If you do not want both 'comments' and 'commentstring' dynamically defined,
  37. " put in your vimrc: let g:rnw_dynamic_comments = 0
  38. if !exists("g:rnw_dynamic_comments") || (exists("g:rnw_dynamic_comments") && g:rnw_dynamic_comments == 1)
  39. augroup RnwCStr
  40. autocmd!
  41. autocmd CursorMoved <buffer> call SetRnwCommentStr()
  42. augroup END
  43. endif
  44. if exists('b:undo_ftplugin')
  45. let b:undo_ftplugin .= " | setl isk< sua< com< cms< | unlet! b:browsefilter"
  46. else
  47. let b:undo_ftplugin = "setl isk< sua< com< cms< | unlet! b:browsefilter"
  48. endif
  49. let &cpo = s:cpo_save
  50. unlet s:cpo_save
  51. " vim: sw=2