1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
<https://github.com/nvim-treesitter/nvim-treesitter> patching
`lua/nvim-treesitter/parsers.lua`.
|