diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-15 17:25:47 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-15 19:40:46 -0400 |
| commit | d0cd8444fa69269803d9cda8af6277d2cdbecaee (patch) | |
| tree | 6e7d34e1e0774dcc684dd93459d1b4df94fe1083 /sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm | |
| parent | ssp test-abstraction-ssp.sh script minor (diff) | |
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)
Diffstat (limited to 'sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm')
| -rw-r--r-- | sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm b/sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm new file mode 100644 index 0000000..0a82481 --- /dev/null +++ b/sundry/editor-syntax-etc/nvim/queries/sisu/textobjects.scm @@ -0,0 +1,140 @@ +; Text-object queries for SiSU Spine markup. +; +; Capture conventions follow nvim-treesitter/textobjects: +; @<thing>.outer -> select including delimiters / surrounding whitespace +; @<thing>.inner -> select content only +; +; Hosts that consume these (Neovim's nvim-treesitter-textobjects, Helix, +; Emacs treesit) bind keys such as `af` / `if` to .outer / .inner. + +; ================================================================= +; Headings (sectioning units) +; ================================================================= +; A whole heading line is a "section header" object. Heading sections +; (the heading plus its body content up to the next heading of equal or +; higher level) are not directly expressible in tree-sitter without +; additional grammar work; hosts can synthesise that from these captures. + +(heading_part) @class.outer +(heading_part + content: (heading_content) @class.inner) + +(heading_segment) @class.outer +(heading_segment + content: (heading_content) @class.inner) + +; ================================================================= +; Block elements (code / poem / block / group / table / quote) +; ================================================================= +; Whole block including delimiters; raw_content is the inner. + +(code_block_curly) @function.outer +(code_block_curly + content: (raw_content) @function.inner) + +(code_block_tic) @function.outer +(code_block_tic + content: (raw_content) @function.inner) + +(poem_block_curly) @function.outer +(poem_block_curly + content: (raw_content) @function.inner) + +(poem_block_tic) @function.outer +(poem_block_tic + content: (raw_content) @function.inner) + +(block_block_curly) @function.outer +(block_block_curly + content: (raw_content) @function.inner) + +(block_block_tic) @function.outer +(block_block_tic + content: (raw_content) @function.inner) + +(group_block_curly) @function.outer +(group_block_curly + content: (raw_content) @function.inner) + +(group_block_tic) @function.outer +(group_block_tic + content: (raw_content) @function.inner) + +(table_block_curly) @function.outer +(table_block_curly + content: (raw_content) @function.inner) + +(table_block_tic) @function.outer +(table_block_tic + content: (raw_content) @function.inner) + +(quote_block_tic) @function.outer +(quote_block_tic + content: (raw_content) @function.inner) + +(pipe_table) @function.outer + +; ================================================================= +; Footnotes and editor notes +; ================================================================= +; Both share the same outer/inner shape; the inner skips the markers and +; closing delimiters. + +(footnote) @comment.outer +(footnote + (_)+ @comment.inner) + +(editor_note) @comment.outer +(editor_note + (_)+ @comment.inner) + +; ================================================================= +; Links and images +; ================================================================= + +(link) @parameter.outer +(link + text: (link_text) @parameter.inner) + +(image) @parameter.outer +(image + spec: (image_spec) @parameter.inner) + +; ================================================================= +; Paragraph / inline-formatting runs +; ================================================================= + +(paragraph) @block.outer +(paragraph + (_)+ @block.inner) + +; Inline formatting pairs - useful as fine-grained text objects. +; The same delimiter character pattern (e.g. `*{` / `}*`) opens and +; closes each, so .inner is everything between them. + +(emphasis) @assignment.outer +(bold) @assignment.outer +(italic) @assignment.outer +(underline) @assignment.outer +(citation_mark) @assignment.outer +(superscript) @assignment.outer +(subscript) @assignment.outer +(inserted) @assignment.outer +(strikethrough) @assignment.outer +(monospace_inline) @assignment.outer + +; ================================================================= +; Book index entries +; ================================================================= + +(book_index) @attribute.outer +(book_index + (index_content) @attribute.inner) + +; ================================================================= +; Header fields +; ================================================================= + +(header_field) @assignment.outer +(header_field + value: (header_value) @assignment.inner) |
