Skip to content
Stan syntax highlighting for vim
Vim script
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Stan syntax highlighting for vim

To set this up for vim,

  1. create .vim directory in home directory(~), and within that diretory, create three other directories: colors, ftdetect, and syntax.
  2. Add the files provided herein.

The Stan names of functions, distributions and such identified in the syntax file for vim were pulled from RStan version 2.16.2 using rstan::lookup() in R as follows:

d <- c(rstan::lookup("_lpmf$")$StanFunction, sub("_lpmf", "", rstan::lookup("_lpmf$")$StanFunction),
          rstan::lookup("_lpdf$")$StanFunction, sub("_lpdf", "", rstan::lookup("_lpdf$")$StanFunction),
          rstan::lookup("_lcdf$")$StanFunction, sub("_lcdf", "", rstan::lookup("_lcdf$")$StanFunction),
          rstan::lookup("_lccdf$")$StanFunction, sub("_lccdf", "", rstan::lookup("_lccdf$")$StanFunction),
          rstan::lookup("_cdf$")$StanFunction, sub("_cdf", "", rstan::lookup("_cdf$")$StanFunction),
          rstan::lookup("_rng$")$StanFunction, sub("_rng", "", rstan::lookup("_rng$")$StanFunction))

d <- unique(d)

f <- rstan::lookup("[:alnum:]*")$StanFunction

f <- unique(f)

f <- f[-grep("operator", f)]

f <- f[!(f %in% d)]

The other keywords were gathered from the Stan Manual.

You can’t perform that action at this time.