A simple R script to extract Rmarkdown tags to be used with tagbar.
- R (and data.table, stringr package)
- tagbar
-
First, install tagbar
-
Make sure
Rscript
is in your path -
Clone this repo or just download
rmd2ctags.R
(and alsormd2ctags.bat
if you are using Windows) -
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
.
- In vim, run
:TagbarToggle
.
GPL v3
Hongyuan Jia (hongyuanjia@cqu.edu.cn)