The Turmeric Vim plugin provides syntax highlighting for .tur files in Vim
and Neovim. It lives in vim-syntax/ at the repo root.
Copy or symlink the two directories into ~/.vim (Vim) or ~/.config/nvim
(Neovim):
# Vim
cp -r vim-syntax/syntax ~/.vim/syntax/
cp -r vim-syntax/ftdetect ~/.vim/ftdetect/
# Neovim
cp -r vim-syntax/syntax ~/.config/nvim/syntax/
cp -r vim-syntax/ftdetect ~/.config/nvim/ftdetect/
Alternatively, symlink the whole plugin directory so updates are picked up automatically:
# Vim
ln -s "$(pwd)/vim-syntax" ~/.vim/pack/turmeric/start/turmeric
# Neovim
ln -s "$(pwd)/vim-syntax" ~/.config/nvim/pack/turmeric/start/turmeric
Plug '/path/to/turmeric/vim-syntax'
{
dir = "/path/to/turmeric/vim-syntax",
ft = "tur",
}
use { "/path/to/turmeric/vim-syntax", ft = "tur" }
Once installed, any .tur file is automatically highlighted:
defn, defmacro, defstruct, defclass,
definstance, defgadt, defmodule, and all other definition keywordsif, 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):else, :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.
| 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 vim-syntax/syntax/turmeric.vim to be
restructured as a cluster.turl).:: and |>. Arithmetic and comparison
operators (+, -, <, >, =, etc.) are left uncolored, which matches
typical Lisp syntax conventions.vim-syntax/ -- Plugin sourcevim-syntax/syntax/turmeric.vim -- Syntax definitionsvim-syntax/ftdetect/turmeric.vim -- File type detectiontur format CLI