Syntax highlighting

Definitions for syntax coloring are available for the applications below.

Emacs

See https://github.com/qezz/rcl-mode.

Helix

Helix can use the Tree-sitter grammar. In your configuration directory, ensure languages.toml exists, and add the following sections:

[[language]]
name = "rcl"
auto-format = false
file-types = ["rcl"]
formatter = { command = "rcl", args = ["format", "-"] }
indent = { tab-width = 2, unit = "  " }
roots = ["build.rcl"]
scope = "source.rcl"
grammar = "rcl"

[[grammar]]
name = "rcl"
source = { git = "https://github.com/ruuda/rcl.git", rev = "master", subpath = "grammar/tree-sitter-rcl" }

Furthermore, copy grammar/tree-sitter-rcl/queries/highlights_helix.scm into your Helix configuation directory at runtime/queries/rcl/highlights.scm.

Neovim

Neovim can use the Tree-sitter grammar through the nvim-treesitter plugin. Clone the rcl repository, and add the following to your init.lua:

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.rcl = {
  install_info = {
    url = "/checkout/rcl/grammar/tree-sitter-rcl",
    files = {},
    generate_requires_npm = false,
    requires_generate_from_grammar = true,
  }
}

If you haven’t done so already, configure nvim-treesitter, including enabling syntax highlighting. Run :TSInstall rcl to compile the parser and put the shared object on the runtimepath, and copy the highlight query into the queries subdirectory:

cp /checkout/rcl/grammar/tree-sitter-rcl/queries/highlights_nvim.scm /pasers-path/queries/rcl/highlights.scm

Then :set filetype=rcl on a buffer to highlight as RCL.

Pygments

The directory grammar/pygments contains a file rcl.py that you can drop into a Pygments fork in the pygments/lexers directory. This lexer powers the syntax highlighting in this manual.

Tree-sitter

The directory grammar/tree-sitter-rcl contains a Tree-sitter grammar. It can be used by various tools, see the other sections on this page. For hacking on the grammar, see also the Tree-sitter chapter.

Vim

The directory grammar/rcl.vim contains support for highlighting in Vim. You can symlink the contents into your ~/.vim, or use a plugin manager like Pathogen and symlink the directory into ~/.vim/bundle.

External

Aside from editor support, rcl highlight will highlight an expression using its internal parser.