/rmd2ctags

An R script to extract Rmarkdown tags

Primary LanguageRGNU General Public License v3.0GPL-3.0

rmd2ctags

A simple R script to extract Rmarkdown tags to be used with tagbar.

Screenshots

screenshot

Dependencies

  • R (and data.table, stringr package)
  • tagbar

Usage

  1. First, install tagbar

  2. Make sure Rscript is in your path

  3. Clone this repo or just download rmd2ctags.R (and also rmd2ctags.bat if you are using Windows)

  4. And add this to your .vimrc:

let g:tagbar_type_rmd = {
      \   'ctagstype':'rmd',
      \   'ctagsbin': 'path/to/rmd2ctags.R',
      \   'ctagsargs':'',
      \   'kinds':['y:yaml:1', 'h:header', 'c:chunk'],
      \   'sro':'&&&',
      \   'kind2scope':{'y':'yaml', 'h':'header', 'c':'chunk'},
      \   'sort':0
      \ }

If you are using Windows, change ctagsbin to the path of rmd2ctags.bat.

  1. In vim, run :TagbarToggle.

License

GPL v3

Maintainer

Hongyuan Jia (hongyuanjia@cqu.edu.cn)