1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,2 @@
; Used by nvim-treesitter-context
(section) @context

View File

@ -0,0 +1,7 @@
[
(section)
(code_block)
(raw_block)
(list)
(div)
] @fold

View File

@ -0,0 +1,420 @@
; Please note that each editor handles highlighting differently.
; This file is made with Neovim in mind and will not
; work correctly in other editors, but can serve as a starting point.
[
(paragraph)
(comment)
(table_cell)
] @spell
[
(autolink)
(inline_link_destination)
(link_destination)
(code_block)
(raw_block)
(math)
(raw_inline)
(verbatim)
(reference_label)
(class)
(class_name)
(identifier)
(key_value)
(frontmatter)
] @nospell
(full_reference_link
(link_label) @nospell)
(full_reference_image
(link_label) @nospell)
(heading1) @markup.heading.1
(heading2) @markup.heading.2
(heading3) @markup.heading.3
(heading4) @markup.heading.4
(heading5) @markup.heading.5
(heading6) @markup.heading.6
(thematic_break) @string.special
[
(div_marker_begin)
(div_marker_end)
] @punctuation.delimiter
([
(code_block)
(raw_block)
(frontmatter)
] @markup.raw.block
(#set! "priority" 90))
; Remove @markup.raw for code with a language spec
(code_block
.
(code_block_marker_begin)
(language)
(code) @none
(#set! "priority" 90))
[
(code_block_marker_begin)
(code_block_marker_end)
(raw_block_marker_begin)
(raw_block_marker_end)
] @punctuation.delimiter
(language) @attribute
(inline_attribute
_ @conceal
(#set! conceal ""))
((language_marker) @punctuation.delimiter
(#set! conceal ""))
[
(block_quote)
(block_quote_marker)
] @markup.quote
(table_header) @markup.heading
(table_header
"|" @punctuation.special)
(table_row
"|" @punctuation.special)
(table_separator) @punctuation.special
(table_caption
(marker) @punctuation.special)
(table_caption) @markup.italic
[
(list_marker_dash)
(list_marker_plus)
(list_marker_star)
(list_marker_definition)
(list_marker_decimal_period)
(list_marker_decimal_paren)
(list_marker_decimal_parens)
(list_marker_lower_alpha_period)
(list_marker_lower_alpha_paren)
(list_marker_lower_alpha_parens)
(list_marker_upper_alpha_period)
(list_marker_upper_alpha_paren)
(list_marker_upper_alpha_parens)
(list_marker_lower_roman_period)
(list_marker_lower_roman_paren)
(list_marker_lower_roman_parens)
(list_marker_upper_roman_period)
(list_marker_upper_roman_paren)
(list_marker_upper_roman_parens)
] @markup.list
(list_marker_task
(unchecked)) @markup.list.unchecked
(list_marker_task
(checked)) @markup.list.checked
((checked) @constant.builtin
(#offset! @constant.builtin 0 1 0 -1)
(#set! conceal "✓"))
[
(ellipsis)
(en_dash)
(em_dash)
] @string.special
(list_item
(term) @type.definition)
(quotation_marks) @string.special
((quotation_marks) @string.special
(#eq? @string.special "{\"")
(#set! conceal "“"))
((quotation_marks) @string.special
(#eq? @string.special "\"}")
(#set! conceal "”"))
((quotation_marks) @string.special
(#eq? @string.special "{'")
(#set! conceal ""))
((quotation_marks) @string.special
(#eq? @string.special "'}")
(#set! conceal ""))
((quotation_marks) @string.special
(#any-of? @string.special "\\\"" "\\'")
(#offset! @string.special 0 0 0 -1)
(#set! conceal ""))
((hard_line_break) @string.escape
(#set! conceal "↵"))
(backslash_escape) @string.escape
; Only conceal \ but leave escaped character.
((backslash_escape) @string.escape
(#offset! @string.escape 0 0 0 -1)
(#set! conceal ""))
(frontmatter_marker) @punctuation.delimiter
(emphasis) @markup.italic
(strong) @markup.strong
(symbol) @string.special.symbol
(insert) @markup.underline
(delete) @markup.strikethrough
; Note that these aren't standard in nvim-treesitter,
; but I didn't find any that fit well.
(highlighted) @markup.highlighted
(superscript) @markup.superscript
(subscript) @markup.subscript
; We need to target tokens specifically because `{=` etc can exist as fallback symbols in
; regular text, which we don't want to highlight or conceal.
(highlighted
[
"{="
"=}"
] @punctuation.delimiter
(#set! conceal ""))
(insert
[
"{+"
"+}"
] @punctuation.delimiter
(#set! conceal ""))
(delete
[
"{-"
"-}"
] @punctuation.delimiter
(#set! conceal ""))
(superscript
[
"^"
"{^"
"^}"
] @punctuation.delimiter
(#set! conceal ""))
(subscript
[
"~"
"{~"
"~}"
] @punctuation.delimiter
(#set! conceal ""))
([
(emphasis_begin)
(emphasis_end)
(strong_begin)
(strong_end)
(verbatim_marker_begin)
(verbatim_marker_end)
(math_marker)
(math_marker_begin)
(math_marker_end)
(raw_inline_attribute)
(raw_inline_marker_begin)
(raw_inline_marker_end)
] @punctuation.delimiter
(#set! conceal ""))
((math) @markup.math
(#set! "priority" 90))
(verbatim) @markup.raw
((raw_inline) @markup.raw
(#set! "priority" 90))
(comment) @comment
; Don't conceal standalone comments themselves, only delimiters.
(comment
[
"{"
"}"
"%"
] @comment
(#set! conceal ""))
(span
[
"["
"]"
] @punctuation.bracket)
(inline_attribute
[
"{"
"}"
] @punctuation.bracket)
(block_attribute
[
"{"
"}"
] @punctuation.bracket)
[
(class)
(class_name)
] @type
(identifier) @tag
(key_value
"=" @operator)
(key_value
(key) @property)
(key_value
(value) @string)
(link_text
[
"["
"]"
] @punctuation.bracket
(#set! conceal ""))
(autolink
[
"<"
">"
] @punctuation.bracket
(#set! conceal ""))
(inline_link
(inline_link_destination) @markup.link.url
(#set! conceal ""))
(link_reference_definition
":" @punctuation.special)
(full_reference_link
(link_text) @markup.link)
(full_reference_link
(link_label) @markup.link.label
(#set! conceal ""))
(collapsed_reference_link
"[]" @punctuation.bracket
(#set! conceal ""))
(full_reference_link
[
"["
"]"
] @punctuation.bracket
(#set! conceal ""))
(collapsed_reference_link
(link_text) @markup.link)
(collapsed_reference_link
(link_text) @markup.link.label)
(inline_link
(link_text) @markup.link)
(full_reference_image
(link_label) @markup.link.label)
(full_reference_image
[
"!["
"["
"]"
] @punctuation.bracket)
(collapsed_reference_image
[
"!["
"]"
] @punctuation.bracket)
(inline_image
[
"!["
"]"
] @punctuation.bracket)
(image_description) @markup.italic
(image_description
[
"["
"]"
] @punctuation.bracket)
(link_reference_definition
[
"["
"]"
] @punctuation.bracket)
(link_reference_definition
(link_label) @markup.link.label)
(inline_link_destination
[
"("
")"
] @punctuation.bracket)
[
(autolink)
(inline_link_destination)
(link_destination)
(link_reference_definition)
] @markup.link.url
(footnote
(reference_label) @markup.link.label)
(footnote_reference
(reference_label) @markup.link.label)
[
(footnote_marker_begin)
(footnote_marker_end)
] @punctuation.bracket
(todo) @comment.todo
(note) @comment.note
(fixme) @comment.error

View File

@ -0,0 +1,10 @@
; The intention here is to rely on Neovims `autoindent` setting.
; This allows us to not indent after just a single list item
; so we can create narrow lists quickly, but indent blocks inside list items
; to the previous paragraph.
(list_item_content) @indent.auto
(footnote_content) @indent.align
((table_caption) @indent.begin
(#set! indent.immediate 1))

View File

@ -0,0 +1,17 @@
(code_block
(language) @injection.language
(code) @injection.content)
(raw_block
(raw_block_info
(language) @injection.language)
(content) @injection.content)
(raw_inline
(content) @injection.content
(raw_inline_attribute
(language) @injection.language))
(frontmatter
(language) @injection.language
(frontmatter_content) @injection.content)

View File

@ -0,0 +1,17 @@
(link_reference_definition
(link_label) @local.definition)
(footnote
(reference_label) @local.definition)
(collapsed_reference_link
(link_text) @local.reference)
(full_reference_link
(link_label) @local.reference)
(full_reference_image
(link_label) @local.reference)
(footnote_reference
(reference_label) @local.reference)

View File

@ -0,0 +1,133 @@
; The markup doesn't contain elements like "classes" or "functions".
; These are used to provide a reasonable treesitter based jump and
; select experience.
; For instance "change inner function" allows us to replace an
; entire block quote, leaving the ">" prefix.
; The choices are a bit subjective though.
; Classes, the highest level
(thematic_break) @class.outer
(section
(section_content) @class.inner
(#offset! @class.inner 0 0 -1 0)) @class.outer
; Functions, the next level
(heading1
(content) @function.inner) @function.outer
(heading2
(content) @function.inner) @function.outer
(heading3
(content) @function.inner) @function.outer
(heading4
(content) @function.inner) @function.outer
(heading5
(content) @function.inner) @function.outer
(heading6
(content) @function.inner) @function.outer
(div
(content) @function.inner) @function.outer
(block_quote
(content) @function.inner) @function.outer
(code_block
(code) @function.inner) @function.outer
(raw_block
(content) @function.inner) @function.outer
; Inner selects current list item, outer selects whole list
(list
(_) @function.inner) @function.outer
; Inner selects row, outer selects whole table
(table
(_) @function.inner) @function.outer
(footnote
(footnote_content) @function.inner) @function.outer
; Blocks, included inside functions
(list_item
(list_item_content) @block.inner) @block.outer
(table_row) @block.outer
(table_separator) @block.outer
[
(table_cell_alignment)
(table_cell)
] @block.inner
; Attributes, extra things attached to elements
(block_attribute
(args) @attribute.inner) @attribute.outer
(inline_attribute
(args) @attribute.inner) @attribute.outer
(table_caption
(content) @attribute.inner) @attribute.outer
(emphasis
(content) @attribute.inner) @attribute.outer
(strong
(content) @attribute.inner) @attribute.outer
(highlighted
(content) @attribute.inner) @attribute.outer
(insert
(content) @attribute.inner) @attribute.outer
(delete
(content) @attribute.inner) @attribute.outer
(symbol) @attribute.outer
(superscript
(content) @attribute.inner) @attribute.outer
(subscript
(content) @attribute.inner) @attribute.outer
(verbatim
(content) @attribute.inner) @attribute.outer
; Parameters, inside a description of a thing
[
(class_name)
(class)
(identifier)
(key_value)
(language)
] @parameter.outer
[
(key)
(value)
] @parameter.inner
; Statements, extra outer definitions
(link_reference_definition
(_) @statement.inner) @statement.outer
; Footnote is a function, can't reuse that here.
; Use @statement.outer as a jump-to point.
(footnote
(reference_label) @statement.inner)
(footnote
(footnote_marker_begin) @statement.outer)
; Comments
(comment
(content) @comment.inner) @comment.outer