aboutsummaryrefslogtreecommitdiffhomepage
path: root/sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm
blob: aa73af8ae67123c563dafaf0e55f0dbd27230428 (plain)
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
; Indentation queries for SiSU Spine markup.
;
; SiSU markup is largely flat: paragraphs and headings live at column 0,
; block bodies preserve their author-supplied indentation verbatim, and
; nesting is by markers rather than by indent. So indents.scm is mostly a
; no-op - the goal is to ensure that auto-indent on <CR> stays at column 0
; for normal lines and respects existing indentation inside header
; continuations and blocks.

; Tree-sitter indent semantics (per nvim-treesitter and treesit):
;   @indent.begin - increases indent for the following line
;   @indent.end   - matches the @indent.begin and decreases indent
;   @indent.zero  - resets indent to column 0
;   @indent.align - aligns following lines with this node
;   @indent.branch - same level as the parent (for else/elif-style joins)

; Top-level structures live at column 0 - reset to zero on the next line.
(heading_part)         @indent.zero
(heading_segment)      @indent.zero
(paragraph)            @indent.zero
(book_index)           @indent.zero
(composite_include)    @indent.zero
(page_break)           @indent.zero
(horizontal_rule)      @indent.zero
(ocn_suppress_open)    @indent.zero
(ocn_suppress_close)   @indent.zero
(body_comment)         @indent.zero

; Block elements: opening line increases indent for the body, closing
; line returns to zero. Editors that respect this will visually indent
; raw content one step from the delimiter line, which is conventional.
(code_block_curly)  @indent.align
(code_block_tic)    @indent.align
(poem_block_curly)  @indent.align
(poem_block_tic)    @indent.align
(block_block_curly) @indent.align
(block_block_tic)   @indent.align
(group_block_curly) @indent.align
(group_block_tic)   @indent.align
(table_block_curly) @indent.align
(table_block_tic)   @indent.align
(quote_block_tic)   @indent.align

; Header continuation lines are indented by two spaces from column 0;
; mark continuations as align so a host that chooses to auto-indent the
; next continuation line matches the previous one.
(header_field)         @indent.align
(header_continuation)  @indent.align