Using Ctags in rkward
Martin Papenberg
martin.papenberg at uni-duesseldorf.de
Mon Nov 2 08:48:32 GMT 2020
> Ok, I have added that in master just now (as usual, it may be up to 24
> hours for the automated builds to catch up). Please take a look.
Thanks Thomas, this is perfect; I think it is a huge improvement for rkward!
> Finally, Martin, perhaps you could write up a mini-tutorial on setting
> up CTags inside RKWard?
Sure. A primer follows here, but I can also prepare an online tutorial
including screenshots (if you want to include this tutorial on the
website at some point, I can prepare one in Markdown):
---
- CTags has to be installed on the local machine, on Ubuntu this for
example as follows:
* sudo apt install exuberant-ctags
- CTags by default does not have support for the R language, but can be
added by the user. To enable R support, we can add the following lines
to a file ".ctags" in the home directory (if it does not exist, create it):
--langdef=R
--langmap=r:.R.r
--regex-R=/^[ \t]*"?([.A-Za-z][.A-Za-z0-9_]*)"?[ \t]*(<-|=)[
\t]function/\1/f,Functions/
(I got this from Fong Chun Chan's Blog here:
https://tinyheero.github.io/2017/05/13/r-vim-ctags.html)
- In rkward, activate the Ctags plugin:
* Settings -> configure rkward -> Kate Plugins -> check "CTags"
- Now, there should be a CTags button at the botton of the main rkward
window (next to "R Console", "Help Search" etc.). Click the button and
go to "Index targets". Here, you can click "+ Add" to add the directory
that should be indexed by CTags. This has to be done for each directory
where we work with R files (however, it works recursively, so if you
index the upper most directory, all of the directories within are
indexed as well)
- To use CTags, define custom key bindings:
* Settings -> Configure Keyboard Shortcuts -> Action CTags
I think in R, the important actions are "Go To Definition" to jump to a
function definition (I use CTRL-Y) and "Jump back one step" (I use CTRL-Q)
---
It would be nice if anyone can test and verify that this works.
Cheers,
Martin
More information about the rkward-users
mailing list