From d0cd8444fa69269803d9cda8af6277d2cdbecaee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 15 May 2026 17:25:47 -0400 Subject: editors syntax highlighting ... - emacs syntax: add tree-sitter major mode for SiSU spine markup New file sisu-spine-ts-mode.el is a sibling of the existing regex mode, backed by Emacs 29+'s built-in treesit.el and the tree-sitter-sisu grammar. It replaces the long font-lock keyword list with treesit-font-lock-rules grouped into eight features (comment, header, heading, block, inline, note, link, index, misc) so users can dial verbosity via treesit-font-lock-level. It also wires up: - treesit-simple-imenu-settings for a heading outline, - treesit-thing-settings for sentence / paragraph motions, - treesit-defun-type-regexp so C-M-a / C-M-e jump heading-to-heading, - a sisu-spine-ts-install-grammar command that registers treesit-language-source-alist and runs treesit-install-language-grammar so users can install the parser from inside Emacs without leaving the editor. - the original sisu-spine-mode.el is unchanged and supported for Emacs < 29 and for users who prefer regex highlighting. - nvim drop-in: point parser fetch at tools/tree-sitter-sisu sundry/editor-syntax-etc/nvim/ The nvim-treesitter install_info now fetches the parser from https://git.sisudoc.org/projects/tree-sitter-sisu which can be cloned via git://git.sisudoc.org/tools/tree-sitter-sisu The fetched paths: files = { "src/parser.c", "src/scanner.c" } submission of the sisu parser to nvim-treesitter's parsers.lua should be a near-trivial one-liner. - the original vim regex highlighter remains as before - sundry/editor-syntax-etc/vim/syntax/sisu-spine.vim - sundry/editor-syntax-etc/vim/templates/{sst,ssm,ssi}.tpl new skeleton templates for the three SiSU markup file types sets up the YAML header (title, creator, date, rights, classify, identfier) - .gitignore - whitelist the new files (assisted by Claude-Code) --- sundry/editor-syntax-etc/nvim/README.md | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sundry/editor-syntax-etc/nvim/README.md (limited to 'sundry/editor-syntax-etc/nvim/README.md') diff --git a/sundry/editor-syntax-etc/nvim/README.md b/sundry/editor-syntax-etc/nvim/README.md new file mode 100644 index 0000000..8e889e7 --- /dev/null +++ b/sundry/editor-syntax-etc/nvim/README.md @@ -0,0 +1,87 @@ +# Neovim integration for SiSU spine markup + +Tree-sitter-backed syntax highlighting, folding, and structural +navigation for `.sst` / `.ssm` / `.ssi` files in Neovim (>= 0.9). + +## What is in this directory + +``` +nvim/ + ftdetect/sisu.lua - register .sst/.ssm/.ssi as filetype "sisu" + ftplugin/sisu.lua - per-buffer settings (commentstring, conceal) + lua/sisu-spine/init.lua - entry point: registers parser config + queries/sisu/ - tree-sitter queries (mirrors tree-sitter-sisu/queries/) + highlights.scm + folds.scm + injections.scm + textobjects.scm + indents.scm +``` + +## Install (manual) + +1. Symlink or copy this directory into your Neovim runtime path: + + ```sh + ln -s /path/to/sisudoc-spine/sundry/editor-syntax-etc/nvim \ + ~/.config/nvim/pack/sisu/start/sisu-spine + ``` + +2. Tell `nvim-treesitter` how to fetch the parser. Add to your config + (`init.lua`): + + ```lua + require("sisu-spine").setup() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "sisu" }, + highlight = { enable = true }, + indent = { enable = true }, + fold = { enable = true }, + textobjects = { select = { enable = true, lookahead = true } }, + }) + ``` + +3. Build the parser: + + ```vim + :TSInstall sisu + ``` + +That is it. Open a `.sst` file - highlighting, folding, and textobject +selection should all work. + +## Install (lazy.nvim) + +```lua +{ + dir = "/path/to/sisudoc-spine/sundry/editor-syntax-etc/nvim", + name = "sisu-spine", + ft = { "sisu" }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + config = function() + require("sisu-spine").setup() + end, +} +``` + +## Sync queries from upstream + +The query files are duplicated from `tree-sitter-sisu/queries/` so that +this Neovim drop-in works without depending on the parser repo's +checkout layout. To refresh them after grammar changes: + +```sh +cp ../../../sisudoc-spine-tools/tree-sitter-sisu/queries/*.scm \ + queries/sisu/ +``` + +(Path is relative to this README.) + +## Upstreaming the parser + +When the parser is publicly hosted under a stable URL it is worth +submitting a config to `nvim-treesitter` so users can run `:TSInstall +sisu` without the local `setup()` call. The required fields are in +`lua/sisu-spine/init.lua` (`install_info` table); send a PR to + patching +`lua/nvim-treesitter/parsers.lua`. -- cgit v1.2.3