Is there any documented use of ctags with R? Would this be useful? Would it be difficult to implement?
Specifically, I\'ve just started using Vim. It would be cool to be
As mentioned by other rtags()
+ etags2ctags()
can generate a tagsfile
for vim (see :h tags-and-searches
). You can create a custom command for vim so that it run rtags()
in R using Rscript
. To do so put this in your .vimrc
:
:command! Rtags :!Rscript -e 'rtags(path="./", recursive=TRUE, ofile="RTAGS")' -e 'etags2ctags("RTAGS", "rtags")' -e 'unlink("RTAGS")'
set tags+=rtags
Now when you do :Rtags
vim will run the external process Rscript
(it has to be in the PATH
of course) and evaluate rtags(path="./", recursive=TRUE, ofile="RTAGS");etags2ctags("RTAGS", "rtags");unlink("RTAGS")
. rtags()
will generate an RTAGS
file in Emacs tags format then etags2ctags()
will transform that into an rtags
file which vim can read. unlink()
deletes the RTAGS
file since it's not needed for vim.
The set tags+=rtags
makes vim to search for an rtags
file in addition to the usual tags
file (See :h tags-and-searches
)