Home Explore Blog CI



neovim

6th chunk of `runtime/doc/treesitter.txt`
83f68191d00c018d105eef86528ffa07ae51b987ff6f4dfc0000000100000fa9
 dot. For
instance, to highlight comments differently per language: >vim

    hi @comment.c guifg=Blue
    hi @comment.lua guifg=DarkBlue
    hi link @comment.documentation.java String
<
The following is a list of standard captures used in queries for Nvim,
highlighted according to the current colorscheme (use |:Inspect| on one to see
the exact definition):

@variable                       various variable names
@variable.builtin               built-in variable names (e.g. `this`, `self`)
@variable.parameter             parameters of a function
@variable.parameter.builtin     special parameters (e.g. `_`, `it`)
@variable.member                object and struct fields

@constant               constant identifiers
@constant.builtin       built-in constant values
@constant.macro         constants defined by the preprocessor

@module                 modules or namespaces
@module.builtin         built-in modules or namespaces
@label                  `GOTO` and other labels (e.g. `label:` in C), including heredoc labels

@string                 string literals
@string.documentation   string documenting code (e.g. Python docstrings)
@string.regexp          regular expressions
@string.escape          escape sequences
@string.special         other special strings (e.g. dates)
@string.special.symbol  symbols or atoms
@string.special.path    filenames
@string.special.url     URIs (e.g. hyperlinks)

@character              character literals
@character.special      special characters (e.g. wildcards)

@boolean                boolean literals
@number                 numeric literals
@number.float           floating-point number literals

@type                   type or class definitions and annotations
@type.builtin           built-in types
@type.definition        identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)

@attribute              attribute annotations (e.g. Python decorators, Rust lifetimes)
@attribute.builtin      builtin annotations (e.g. `@property` in Python)
@property               the key in key/value pairs

@function               function definitions
@function.builtin       built-in functions
@function.call          function calls
@function.macro         preprocessor macros

@function.method        method definitions
@function.method.call   method calls

@constructor            constructor calls and definitions
@operator               symbolic operators (e.g. `+`, `*`)

@keyword                keywords not fitting into specific categories
@keyword.coroutine      keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
@keyword.function       keywords that define a function (e.g. `func` in Go, `def` in Python)
@keyword.operator       operators that are English words (e.g. `and`, `or`)
@keyword.import         keywords for including or exporting modules (e.g. `import`, `from` in Python)
@keyword.type           keywords describing namespaces and composite types (e.g. `struct`, `enum`)
@keyword.modifier       keywords modifying other constructs (e.g. `const`, `static`, `public`)
@keyword.repeat         keywords related to loops (e.g. `for`, `while`)
@keyword.return         keywords like `return` and `yield`
@keyword.debug          keywords related to debugging
@keyword.exception      keywords related to exceptions (e.g. `throw`, `catch`)

@keyword.conditional         keywords related to conditionals (e.g. `if`, `else`)
@keyword.conditional.ternary ternary operator (e.g. `?`, `:`)

@keyword.directive           various preprocessor directives and shebangs
@keyword.directive.define    preprocessor definition directives

@punctuation.delimiter  delimiters (e.g. `;`, `.`, `,`)
@punctuation.bracket    brackets (e.g. `()`, `{}`, `[]`)
@punctuation.special    special symbols (e.g. `{}` in string interpolation)

@comment                line and block comments
@comment.documentation  comments documenting code

@comment.error          error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED`)
@comment.warning

Title: Standard Captures Used in Queries for Nvim
Summary
This section provides a comprehensive list of standard captures used in queries for Nvim, categorized by their function and highlighted according to the current colorscheme. It includes captures for variables, constants, modules, labels, strings, characters, booleans, numbers, types, attributes, properties, functions, constructors, operators, keywords, punctuation, and comments. Each capture has more specific sub-categories, such as `@variable.builtin`, `@string.documentation`, `@keyword.conditional`, and `@comment.documentation`. The section provides example usages and explains how to customize highlighting per language.