CTAGS-LANG-R(7)
π¦ ctags-lang-r β Universal Ctags, but make it R π¦
hiii bestie welcome to CTAGS-LANG-R(7), the section 7 manual page for Universal Ctags that's literally just vibes about tagging R code. grab a boba, this one's short and so fun π
π NAME
ctags-lang-r β random notes about tagging R source code with Universal Ctags.
yes the official name really says "random notes" and honestly? that's the energy, we're keeping it, it's iconic β¨
π SYNOPSIS
ctags ... --languages=+R ...
ctags ... --language-force=R ...
ctags ... --map-R=+.r ...
π DESCRIPTION
This man page gathers random notes about tagging R source code with Universal Ctags.
that's the whole description. short, sweet, to the point, ate π«Ά
π KINDS
okay so here's the actual tea, listen up π
If a variable gets a value returned from a well-known constructor and the variable appears for the first time in the current input file, the R parser makes a tag for the variable and attaches a kind associated with the constructor to the tag regardless of whether the variable appears in the top-level context or a function. so like, top level or buried inside a function, doesn't matter, the parser still clocks it π
Well-known constructor and kind mapping:
function()β kindfunctionc()β kindvectorlist()β kindlistdata.frame()β kinddataframe
If a variable doesn't get a value returned from one of well-known constructors, the R parser attaches globalVar or functionVar kind to the tag for the variable depending on the context.
Here is an example demonstrating the usage of the kinds:
"input.r"
G <- 1
v <- c(1, 2)
l <- list(3, 4)
d <- data.frame(n = v)
f <- function(a) {
g <- function (b) a + b
w <- c(1, 2)
m <- list (3, 4)
e <- data.frame(n = w)
L <- 2
}
"output.tags" with --options=NONE --sort=no --fields=+KZ -o - input.r
G input.r /^G <- 1$/;" globalVar
v input.r /^v <- c(1, 2)$/;" vector
l input.r /^l <- list(3, 4)$/;" list
d input.r /^d <- data.frame(n = v)$/;" dataframe
n input.r /^d <- data.frame(n = v)$/;" nameattr scope:dataframe:d
f input.r /^f <- function(a) {$/;" function
g input.r /^ g <- function (b) a + b$/;" function scope:function:f
w input.r /^ w <- c(1, 2)$/;" vector scope:function:f
m input.r /^ m <- list (3, 4)$/;" list scope:function:f
e input.r /^ e <- data.frame(n = w)$/;" dataframe scope:function:f
n input.r /^ e <- data.frame(n = w)$/;" nameattr scope:dataframe:f.e
L input.r /^ L <- 2$/;" functionVar scope:function:f
look at that scoping. the nesting. the nameattr showing up twice with different scopes. we love to see it, periodt π
π SEE ALSO
okay that's the whole page bestie, you're officially a ctags-lang-r girlie now π this was version 6.2.1 of the CTAGS-LANG-R(7) manual page, no cap π¦β¨
π¦ where this page comes from
- alpine 3.24: ctags-doc 6.2.1-r0 Β· GPL-2.0-or-later
- fedora 43: ctags 6.2.1-1.fc43 Β· GPL-2.0-or-later
- fedora 44: ctags 6.2.1-3.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms