Indentation script for R

Pierre de Villemereuil pierre.de.villemereuil at mailoo.org
Sat Nov 4 08:41:11 UTC 2017


Hi there,

I grew tired of hitting Tab far too often, so I've been working on a R indentation file for Kate (well, for RKward really):
https://github.com/devillemereuil/rindent

I think this indentation scheme follows a sound style for R, especially it tries to be consistent for brackets matching and arguments of functions (i.e. it tries to smartly indent when an argument called with '=' is not closed). You can see the example file for, well, an example.

It allows support the use of the tidyverse pipes (%>%) for which (as well as for a good list of operators like '+'), it indents only the first time to create an indentation block corresponding a complete command in R (unindenting is up to the user in that case, however: I fear trying to be too smart about this would break too many things...).

Maybe this can be useful for other RKward users and I humbly submit this for consideration for the RKward devs to include in a future release if they think this is nice and relevant enough.

Comments, testing and pull requests are more than welcome!

Cheers,
Pierre


More information about the rkward-devel mailing list