Vim and Neovim support for Sema: syntax highlighting, filetype detection, and Lisp-aware editor settings for .sema files.
Because this repository uses the standard plugin layout (ftdetect/, ftplugin/, syntax/ at the root), no runtimepath override is needed — install it like any other plugin.
Plug 'sema-lisp/sema.vim'{ "sema-lisp/sema.vim" }use "sema-lisp/sema.vim"git clone https://github.com/sema-lisp/sema.vim.git \
~/.vim/pack/plugins/start/sema.vim
# Neovim:
git clone https://github.com/sema-lisp/sema.vim.git \
~/.local/share/nvim/site/pack/plugins/start/sema.vimCopy the directories into your Vim (~/.vim) or Neovim (~/.config/nvim) config:
git clone https://github.com/sema-lisp/sema.vim.git
cp -r sema.vim/{ftdetect,ftplugin,syntax} ~/.vim/- Filetype detection —
.semafiles are automatically detected assema. - Syntax highlighting — special forms, builtins (including LLM/agent primitives like
llm/chat,agent/run,defagent,deftool), threading macros (->,->>,as->), keyword literals, strings with escapes, numbers, booleans, character literals, quoting/unquoting, line (;) and block (#| … |#) comments, and definition-name highlighting. - Lisp-aware editing —
lispmode with a curatedlispwordslist (including Sema forms such asdefagent,deftool,with-budget), 2-space indentation, andiskeywordextended for Sema identifiers (!?/-<>*#). - Comment settings —
commentstringandcommentsconfigured for;line comments.
This is a pure Vimscript plugin — no external dependencies, works in both Vim and Neovim.
- Vim 7+ or Neovim — the plugin is pure Vimscript with no runtime dependencies.
- The
semabinary is only needed to run Sema code, not for editing. Install it from the Sema project.
Sema ships a built-in language server (sema lsp) providing completions, hover docs, go-to-definition, find references, rename, signature help, diagnostics, document symbols, and code lens. This plugin does not start it for you — wire it up with your LSP client of choice.
vim.api.nvim_create_autocmd('FileType', {
pattern = 'sema',
callback = function()
vim.lsp.start({
name = 'sema',
cmd = { 'sema', 'lsp' },
root_dir = vim.fs.dirname(vim.fs.find({ 'sema.toml', '.git' }, { upward = true })[1]),
})
end,
})Add to :CocConfig:
{
"languageserver": {
"sema": {
"command": "sema",
"args": ["lsp"],
"filetypes": ["sema"]
}
}
}The Sema LSP server also emits a custom sema/evalResult notification for inline evaluation results; displaying it requires a custom client handler (see the Sema documentation).
| Group | What it covers |
|---|---|
semaSpecial |
Special forms (define, lambda, if, defagent…) |
semaBuiltin |
Builtin functions (map, llm/chat, file/read…) |
semaThreading |
Threading macros (->, ->>, as->) |
semaOperator |
Arithmetic/comparison operators (+, -, <=…) |
semaKeyword |
Keyword literals (:model, :temperature…) |
semaString |
String literals |
semaStringEscape |
Escape sequences in strings |
semaNumber |
Integer and float literals |
semaBoolean |
#t, #f, true, false |
semaConstant |
nil |
semaCharacter |
Character literals (#\a, #\space…) |
semaComment |
Line comments (;) |
semaBlockComment |
Block comments (#| … |#) |
semaTodo |
TODO/FIXME/XXX/HACK/NOTE in comments |
semaDefineVar |
Names bound by (define name …) / set! |
semaDefineFun |
Names bound by (define (f …)), defun, defmacro… |
semaQuote |
Quote (') and quasiquote (`) prefixes |
semaUnquote |
Unquote (,) and unquote-splicing (,@) |
semaParens |
Parentheses, brackets, and braces |
Override any group in your colorscheme to customise appearance.
- Website — sema-lang.com
- Playground — sema.run
- Documentation — sema-lang.com/docs
- Grammar — tree-sitter-sema
- Repository — sema-lisp/sema.vim