Editor Support
Sema has editor plugins for VS Code, Vim/Neovim, Emacs, Helix, and Zed. All plugins provide syntax highlighting for the full standard library (350+ functions), special forms, keyword literals, character literals, strings, numbers, comments, and LLM primitives.
Source code for all editor plugins is in the editors/ directory.
VS Code
TextMate grammar-based extension with full syntax highlighting, bracket matching, auto-closing pairs, comment toggling, and indentation support.
Install
EXT_DIR=~/.vscode/extensions/helgesverre.sema-0.1.0
mkdir -p "$EXT_DIR/syntaxes"
BASE=https://raw.githubusercontent.com/HelgeSverre/sema/main/editors/vscode/sema
curl -fsSL "$BASE/package.json" -o "$EXT_DIR/package.json"
curl -fsSL "$BASE/language-configuration.json" -o "$EXT_DIR/language-configuration.json"
curl -fsSL "$BASE/syntaxes/sema.tmLanguage.json" -o "$EXT_DIR/syntaxes/sema.tmLanguage.json"
curl -fsSL "$BASE/icon.png" -o "$EXT_DIR/icon.png"Restart VS Code after installing.
Features
- Syntax highlighting (special forms, builtins, LLM primitives, keywords, strings, numbers, booleans, character literals, comments)
- Bracket matching and auto-closing for
(),[],{},"" - Comment toggling (Ctrl+/ / Cmd+/)
- Indentation rules for all bracket types
- Arithmetic/comparison operator highlighting
Vim / Neovim
Pure Vimscript plugin with syntax highlighting, filetype detection, and Lisp-aware indentation.
vim-plug
Plug 'helgesverre/sema', { 'rtp': 'editors/vim' }lazy.nvim
{
"helgesverre/sema",
config = function(plugin)
vim.opt.rtp:append(plugin.dir .. "/editors/vim")
end,
}Manual (Vim)
mkdir -p ~/.vim/syntax ~/.vim/ftdetect ~/.vim/ftplugin
BASE=https://raw.githubusercontent.com/HelgeSverre/sema/main/editors/vim
curl -fsSL "$BASE/syntax/sema.vim" -o ~/.vim/syntax/sema.vim
curl -fsSL "$BASE/ftdetect/sema.vim" -o ~/.vim/ftdetect/sema.vim
curl -fsSL "$BASE/ftplugin/sema.vim" -o ~/.vim/ftplugin/sema.vimManual (Neovim)
mkdir -p ~/.config/nvim/syntax ~/.config/nvim/ftdetect ~/.config/nvim/ftplugin
BASE=https://raw.githubusercontent.com/HelgeSverre/sema/main/editors/vim
curl -fsSL "$BASE/syntax/sema.vim" -o ~/.config/nvim/syntax/sema.vim
curl -fsSL "$BASE/ftdetect/sema.vim" -o ~/.config/nvim/ftdetect/sema.vim
curl -fsSL "$BASE/ftplugin/sema.vim" -o ~/.config/nvim/ftplugin/sema.vimFeatures
- Full syntax highlighting (special forms, 350+ builtins, LLM primitives, keywords, character literals, comments)
- Automatic filetype detection for
.semafiles - Lisp-aware indentation with correct
lispwordsfor all Sema special forms - Comment string configured for
;
Emacs
Major mode derived from prog-mode with Lisp-aware indentation, REPL integration, and imenu support.
Manual
mkdir -p ~/.emacs.d/site-lisp
curl -fsSL https://raw.githubusercontent.com/HelgeSverre/sema/main/editors/emacs/sema-mode.el \
-o ~/.emacs.d/site-lisp/sema-mode.el(add-to-list 'load-path "~/.emacs.d/site-lisp")
(require 'sema-mode)use-package
(use-package sema-mode
:load-path "~/.emacs.d/site-lisp"
:mode "\\.sema\\'")Doom Emacs
In packages.el:
(package! sema-mode :recipe (:local-repo "~/.emacs.d/site-lisp"))In config.el:
(use-package! sema-mode :mode "\\.sema\\'")Features
- Syntax highlighting (special forms, builtins, keyword literals, booleans, character literals, numbers, strings, comments)
- Buffer-local Lisp indentation with Sema-specific form rules
- REPL integration — start a Sema REPL and send code interactively
- imenu support for navigating
defun,define,defmacro,defagent,deftool, anddefine-record-typedefinitions - Electric pairs for
(),[],{},"" - Proper sexp navigation with quote (
'), quasiquote (`), and unquote (,) prefix handling
Key Bindings
| Key | Command | Description |
|---|---|---|
C-c C-z | sema-repl | Start or switch to the Sema REPL |
C-c C-e | sema-send-last-sexp | Send sexp before point to REPL |
C-c C-r | sema-send-region | Send selected region to REPL |
C-c C-b | sema-send-buffer | Send entire buffer to REPL |
C-c C-l | sema-run-file | Run current file with sema |
Configuration
;; Path to the sema binary (default: "sema")
(setq sema-program "/path/to/sema")Helix
Syntax highlighting using the dedicated tree-sitter-sema grammar, with Sema-specific highlight queries, text objects, and indentation.
Install
Download and append the language config to your Helix configuration:
bashBASE=https://raw.githubusercontent.com/HelgeSverre/sema/main/editors/helix curl -fsSL "$BASE/languages.toml" >> ~/.config/helix/languages.tomlIf you already have a
languages.toml, manually merge the[[language]]and[[grammar]]sections.Download the query files:
bashmkdir -p ~/.config/helix/runtime/queries/sema for f in highlights indents textobjects injections; do curl -fsSL "$BASE/queries/sema/$f.scm" \ -o ~/.config/helix/runtime/queries/sema/$f.scm doneFetch and build the Sema grammar:
bashhx --grammar fetch hx --grammar buildVerify:
bashhx --health sema
Features
- Syntax highlighting via tree-sitter queries (special forms, builtins, LLM primitives, keywords, booleans, character literals, strings, comments)
- Text objects —
maf/miffor function definitions,mac/micfor agent/tool definitions - Smart auto-pairs for
(),[],{},"" - Indentation support
;line comments
How It Works
The grammar = "sema" setting tells Helix to parse .sema files using the tree-sitter-sema grammar, which provides native support for Sema-specific syntax like keyword literals (:name), hash maps, and vectors. Custom query files in queries/sema/ provide Sema-specific captures for LLM primitives, slash-namespaced builtins (string/trim, llm/chat), and special forms like defagent and deftool.
Zed
Extension using the dedicated tree-sitter-sema grammar with full syntax highlighting, bracket matching, code outline, and auto-pairs.
Install
- Open Zed
- Go to Zed → Extensions (or Cmd+Shift+X)
- Click Install Dev Extension
- Select the
editors/zeddirectory from the Sema repository
Features
- Syntax highlighting (special forms, 350+ builtins, LLM primitives, keyword literals, booleans,
nil, strings, comments) - Smart auto-pairs for
(),[],{},"" - Code outline for
define,defun,defmacro,defagent,deftool - Bracket matching
;line comments- 2-space indentation