Editor support
Three plugins, all maintained here: VS Code, Emacs, and Vim with Neovim. Each gives you highlighting that knows where a word is rather than only what it is, and each is tested rather than eyeballed — though not all three are tested against the same thing, and this page says which.
You want one of these after you have the compiler and the player, not instead of them. None of them compiles anything: they read .zaytun source and make it legible.
Which one does what
| Plugin | Editor | Beyond highlighting | Tested against |
|---|---|---|---|
| zaytun-language | VS Code | outline, go to definition across included files, hover, completion, and
the compiler's own errors in the problems pane |
its grammar, scope by scope |
| zaytun-mode | Emacs | indentation, eldoc, and the compiler's errors through compile |
every game in this project, against an independent count of what it found |
| zaytun-vim | Vim, Neovim | indentation, :make with the errors in the quickfix list, comments |
the compiler's own published keyword list, plus the syntax group the editor assigns each token |
Only one of them is checked against the compiler, and it is worth knowing which. zaytunc publishes keywords.txt — every word its parser tests for — and zaytun-vim fails its own tests unless all 176 of them are highlighted or listed as exempt with a reason. The other two do not compare, so a word the language gains can reach a release before their highlighting does. That is a gap in those two rather than a complaint about them, and it is written down here so nobody has to find it out by their program being the wrong colour.
Highlighting that knows where a word is
Most of Zaytun's words mean different things in different places, and colouring them on sight is how a syntax file starts telling its author things that are not true. All three plugins are positional where the language is:
description:- a field, because of the colon. Elsewhere it is somebody's variable and is left alone.
dark if lamplit- a guard, because of the
if— the same shape astakes if,opens ifandbare if. sees out if hatch- the two a room of a hull has, which put
outin the middle of the phrase. reset turn,reset elapsed- the pair is the statement. A game may have a flag, an item or a verb of its own
called
reset, and it keeps it — taking a word back from games that already use it is the kind of change only noticed by somebody whose game stops working. on enter- only the words
onaccepts. Anything else afteronis a compile error, andonby itself is not anything. trunc(x)- a builtin, because of the open paren.
room hall "The Hall"- and
hallis coloured as the name it is, which is what you search for.
Installing
VS Code
Not on the Marketplace. Download zaytun-language-1.1.0.vsix from its releases and:
code --install-extension zaytun-language-1.1.0.vsix
Or in VS Code: Extensions → … → Install from VSIX.
Emacs
Not on MELPA. Put zaytun-mode.el on your load-path:
(require 'zaytun-mode)
Vim and Neovim
No plugin manager needed — both read packages out of a directory:
# Vim
git clone https://codeberg.org/zaytun-project/zaytun-vim \
~/.vim/pack/zaytun/start/zaytun-vim
# Neovim
git clone https://codeberg.org/zaytun-project/zaytun-vim \
~/.local/share/nvim/site/pack/zaytun/start/zaytun-vim
Then open a .zaytun file. With a plugin manager, point it at the repository in the usual way.
When a game opens as the wrong thing
A Zaytun game begins with # comments, and an editor that does not know the extension will guess from that — Vim's own content sniffing calls it a configuration file. If a game comes up grey, or coloured as something it is not, the plugin is not loaded rather than broken.
In Vim or Neovim, :set filetype? answers the question. If it says anything but zaytun, the plugin is not on the runtime path — check that it is in the pack/…/start/ directory above and not beside it. :set filetype=zaytun proves it for one buffer without fixing the cause.
Versions
The plugins track the language rather than the toolchain, so their numbers are their own. The VS Code and Emacs ones are at 1.1.0; zaytun-vim is at 1.0.0 because it is new, not because the language went backwards. What changed in the language itself is on the releases page.