Syntax highlighting of roxygen documentation in TextMate

August 2, 2011
By

(This article was first published on cameron.bracken.bz » R, and kindly contributed to R-bloggers)

With roxygen now on github, the release of roxygen2 and Hadley’s might now behind the project I expect roxygen to gain even more momentum.

R development in TextMate is great with the R bundle. Unfortunately the R bundle does not support highlighting of roxygen documentation by default. That was always a sticking point for me switching to roxygen because TextMate has really nice highlighting for Rd files.

So I hacked on the syntax file to get at least some preliminary highlighting of stuff after roxygen comments (#'). The file is in a gist over at github. It doesn’t yet work quite as well as I would like but it is better than nothing. In particular, highlighting of R code in examples does not work. Contributions/additions are welcome.

You must have must have the R bundle installed. The easiest way to install is to open the bundle editor (“Bundles” > “Bundle Editor” > “Show Bundle Editor”) and copy this file over the R syntax file from the R bundle. Then “Reload Bundles” or restart TextMate.

You may need to install the R bundle first if you have not already:

mkdir -p /Library/Application\ Support/TextMate/Bundles
cd /Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Bundles/R.tmbundle

Then either reload the bundles or restart TextMate to get the bundle activated.

To leave a comment for the author, please follow the link and comment on his blog: cameron.bracken.bz » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series,ecdf, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.