The Turmeric Vim plugin provides syntax highlighting for .tur files in Vim
and Neovim. It lives in its own repo,
turmeric-lang/vim-turmeric.
Plug 'turmeric-lang/vim-turmeric'
{ "turmeric-lang/vim-turmeric", ft = "turmeric" }
use { "turmeric-lang/vim-turmeric", ft = "turmeric" }
# Vim
git clone https://github.com/turmeric-lang/vim-turmeric ~/.vim/pack/turmeric/start/vim-turmeric
# Neovim
git clone https://github.com/turmeric-lang/vim-turmeric ~/.local/share/nvim/site/pack/turmeric/start/vim-turmeric
Clone the repo, then copy its syntax, ftdetect and ftplugin directories
into ~/.vim (Vim) or ~/.config/nvim (Neovim). ftplugin sets the comment
string, two-space indent and Lisp indentation words.
Once installed, any .tur file is automatically highlighted:
defn, defmacro, defstruct, defclass,
definstance, defdata, defmodule, and all other definition keywords
(the deprecated defgadt included)if, cond, case, match, loop, while, for,
and, or, nottype, typeclass, forall, where, impl, traiteffect, handle, perform, do, withtry, catch, throw, finally, raiselet, let*, lambda, fn, begin, quote formscons, map, filter, reduce, vec, len,
predicates (string?, list?, null?, etc.), and more0xFF), binary (0b1010), floats,
scientific notation, booleans (#t, #f), characters (#\a, #\newline)\n, \t, A, etc.);), docstring comments (;;;), and block
comments (#| ... |#, nestable):as, :pre, :post, :name, and other
colon-prefixed symbols^linear, ^unique, ^affine, ^mut, etc.'), quasiquote (`), unquote (~),
unquote-splicing (~@):: (type ascription), |> (pipe)```c ... ``` blocks highlighted as preprocessorAdd to your ~/.vim/after/ftplugin/turmeric.vim (Vim) or the equivalent Lua
config (Neovim):
" Turmeric ftplugin settings
setlocal tabstop=2
setlocal shiftwidth=2
setlocal expandtab
setlocal textwidth=80
" Use ; as the comment leader for commentary.vim / comment operators
setlocal commentstring=;\ %s
" Treat hyphens as part of words for motions (already set by syntax file,
" but explicit here for clarity)
setlocal iskeyword+=45
For Neovim with nvim-treesitter not yet supporting Turmeric, the Vim syntax
file is the correct fallback -- no additional configuration is needed.
The plugin's colors/ directory carries the two themes turmeric-lang.com uses, ported
from the Try Turmeric editor: turmeric-dark and turmeric-light. Both need
a true-color terminal. A plugin manager or native package puts them on the runtimepath for you, so just pick one:
set termguicolors
colorscheme turmeric-light " or turmeric-dark
Each scheme sets background itself. To follow the terminal's own setting
instead, choose by it:
execute 'colorscheme turmeric-' . (&background ==# 'light' ? 'light' : 'dark')
| Group | Default link | Matches |
|---|---|---|
turmericDefine |
Define |
defn, defmacro, defstruct, etc. |
turmericControl |
Conditional |
if, cond, match, loop, etc. |
turmericType |
Type |
type, typeclass, forall, where |
turmericEffect |
Keyword |
effect, handle, perform, with |
turmericExcept |
Exception |
try, catch, throw, finally |
turmericSpecial |
Special |
let, let*, lambda, fn, begin |
turmericBuiltin |
Function |
Built-in functions and predicates |
turmericNil |
Constant |
nil, null, none, unit |
turmericInt |
Number |
Integer literals |
turmericFloat |
Float |
Floating-point literals |
turmericHex |
Number |
Hex literals (0xFF) |
turmericBin |
Number |
Binary literals (0b1010) |
turmericBool |
Boolean |
#t, #f |
turmericChar |
Character |
Character literals (#\a, #\newline) |
turmericString |
String |
String literals |
turmericStringEsc |
SpecialChar |
Valid escape sequences |
turmericBadEsc |
Error |
Unrecognized escape sequences |
turmericKeyLit |
Constant |
Keyword literals (:name) |
turmericMeta |
PreProc |
Metadata annotations (^linear) |
turmericLineComment |
Comment |
; and ;; line comments |
turmericDocComment |
SpecialComment |
;;; docstring comments |
turmericBlockComment |
Comment |
#| ... |# block comments |
turmericTodo |
Todo |
TODO, FIXME, HACK, NOTE, XXX |
turmericQuote |
Special |
', ` |
turmericUnquote |
Special |
~ |
turmericSplice |
Special |
~@ |
turmericOp |
Operator |
::, |> |
turmericCBlock |
PreProc |
```c ... ``` inline C blocks |
turmericDelim |
Delimiter |
(), [], {} |
To override a highlight group, add lines like this to your colorscheme or
after/syntax/turmeric.vim:
hi turmericDocComment guifg=#a0c4ff gui=italic
hi turmericDefine guifg=#ffd166 gui=bold
The syntax file links turmericDelim to Delimiter. If you use a rainbow
parentheses plugin (e.g. rainbow, rainbow_parentheses.vim), add Turmeric
to its file type list:
" rainbow_parentheses.vim
au VimEnter * RainbowParenthesesActivate
au Syntax turmeric RainbowParenthesesLoadRound
au Syntax turmeric RainbowParenthesesLoadSquare
au Syntax turmeric RainbowParenthesesLoadBraces
For nvim-ts-rainbow or rainbow-delimiters.nvim in Neovim, no extra
configuration is needed once Treesitter supports Turmeric.
#| ... |# block comment nesting is syntactically correct but Vim's
highlight engine does not track nesting depth, so deeply nested block
comments may mis-highlight.```c ... ```) are highlighted as PreProc rather
than embedded C syntax. Embedded language highlighting is possible with
:syn include but requires the plugin's syntax/turmeric.vim to be
restructured as a cluster.tur lsp)
through your LSP client of choice (e.g. Neovim's vim.lsp.start or
nvim-lspconfig with a custom server entry running tur lsp).:: and |>. Arithmetic and comparison
operators (+, -, <, >, =, etc.) are left uncolored, which matches
typical Lisp syntax conventions.tur format CLI