nvim-treesitter/queries/vim/highlights.scm

291 lines
4 KiB
Scheme
Raw Normal View History

2021-08-20 13:35:04 -05:00
(identifier) @variable
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
2021-08-20 13:35:04 -05:00
2021-04-18 09:57:02 +02:00
;; Keywords
[
"if"
"else"
"elseif"
"endif"
] @conditional
[
"try"
"catch"
"finally"
"endtry"
"throw"
] @exception
[
"for"
"endfor"
"in"
"while"
"endwhile"
2022-08-17 11:09:14 +02:00
"break"
"continue"
2021-04-18 09:57:02 +02:00
] @repeat
[
"function"
"endfunction"
] @keyword.function
;; Function related
(function_declaration name: (_) @function)
2022-11-21 11:00:23 +00:00
(call_expression function: (identifier) @function.call)
(call_expression function: (scoped_identifier (identifier) @function.call))
(parameters (identifier) @parameter)
(default_parameter (identifier) @parameter)
2021-04-18 09:57:02 +02:00
2022-09-07 09:30:00 +02:00
[ (bang) (spread) ] @punctuation.special
2021-04-18 09:57:02 +02:00
[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
2021-08-20 13:35:04 -05:00
[
(scope)
"a:"
"$"
] @namespace
2021-04-18 09:57:02 +02:00
;; Commands and user defined commands
[
"let"
"unlet"
2022-05-01 19:19:39 +02:00
"const"
2021-04-18 09:57:02 +02:00
"call"
"execute"
"normal"
"set"
"setfiletype"
"setlocal"
2021-04-18 09:57:02 +02:00
"silent"
"echo"
"echon"
"echohl"
"echomsg"
"echoerr"
2021-04-18 09:57:02 +02:00
"autocmd"
2021-08-20 14:44:24 +02:00
"augroup"
2021-04-18 09:57:02 +02:00
"return"
"syntax"
2022-10-15 10:54:43 +02:00
"filetype"
"source"
2021-04-18 09:57:02 +02:00
"lua"
"ruby"
"perl"
"python"
"highlight"
2022-08-23 14:17:55 +02:00
"command"
2022-01-19 16:31:29 +01:00
"delcommand"
"comclear"
"colorscheme"
"startinsert"
"stopinsert"
"global"
"runtime"
"wincmd"
2022-08-23 14:17:55 +02:00
"cnext"
"cprevious"
"cNext"
"vertical"
"leftabove"
"aboveleft"
"rightbelow"
"belowright"
"topleft"
"botright"
(unknown_command_name)
2022-08-26 20:20:49 +02:00
"edit"
"enew"
"find"
"ex"
"visual"
"view"
2022-11-21 11:00:23 +00:00
"eval"
2021-04-18 09:57:02 +02:00
] @keyword
2021-08-20 10:05:34 +02:00
(map_statement cmd: _ @keyword)
(command_name) @function.macro
2021-04-18 09:57:02 +02:00
2022-10-15 10:54:43 +02:00
;; Filetype command
(filetype_statement [
"detect"
"plugin"
"indent"
"on"
"off"
] @keyword)
;; Syntax command
(syntax_statement (keyword) @string)
(syntax_statement [
"enable"
"on"
"off"
"reset"
"case"
"spell"
"foldlevel"
"iskeyword"
"keyword"
2022-01-19 16:31:29 +01:00
"match"
"cluster"
"region"
"clear"
"include"
] @keyword)
2022-01-19 16:31:29 +01:00
(syntax_argument name: _ @keyword)
2021-08-20 10:05:34 +02:00
[
"<buffer>"
"<nowait>"
"<silent>"
"<script>"
"<expr>"
"<unique>"
] @constant.builtin
(augroup_name) @namespace
(au_event) @constant
2021-04-18 09:57:02 +02:00
(normal_statement (commands) @constant)
;; Highlight command
2022-09-07 09:30:00 +02:00
(hl_attribute
key: _ @property
val: _ @constant)
(hl_group) @type
(highlight_statement [
"default"
"link"
"clear"
] @keyword)
2022-08-23 14:17:55 +02:00
;; Command command
2022-09-07 09:30:00 +02:00
(command) @string
2022-08-23 14:17:55 +02:00
(command_attribute
2022-08-26 20:20:49 +02:00
name: _ @property
2022-08-23 14:17:55 +02:00
val: (behavior
2022-08-26 20:20:49 +02:00
name: _ @constant
val: (identifier)? @function)?)
;; Edit command
(plus_plus_opt
val: _? @constant) @property
(plus_cmd "+" @property) @property
2022-08-23 14:17:55 +02:00
;; Runtime command
(runtime_statement (where) @keyword.operator)
;; Colorscheme command
(colorscheme_statement (name) @string)
2021-04-18 09:57:02 +02:00
;; Literals
(string_literal) @string
(integer_literal) @number
(float_literal) @float
2022-09-07 09:30:00 +02:00
(comment) @comment @spell
2022-11-21 11:00:23 +00:00
(line_continuation_comment) @comment @spell
(pattern) @string.special
(pattern_multi) @string.regex
(filename) @string
2022-08-17 11:09:14 +02:00
(heredoc (body) @string)
2022-11-21 11:00:23 +00:00
(heredoc (parameter) @keyword)
[ (marker_definition) (endmarker) ] @label
(literal_dictionary (literal_key) @label)
2021-08-20 13:35:04 -05:00
((scoped_identifier
(scope) @_scope . (identifier) @boolean)
(#eq? @_scope "v:")
(#any-of? @boolean "true" "false"))
2021-04-18 09:57:02 +02:00
;; Operators
[
"||"
"&&"
2021-08-20 13:35:04 -05:00
"&"
2021-04-18 09:57:02 +02:00
"+"
"-"
"*"
"/"
"%"
".."
"is"
"isnot"
"=="
"!="
">"
">="
"<"
"<="
"=~"
"!~"
"="
"+="
"-="
"*="
"/="
"%="
".="
2022-08-26 20:20:49 +02:00
"..="
2022-11-21 11:00:23 +00:00
"<<"
"=<<"
(match_case)
2021-04-18 09:57:02 +02:00
] @operator
; Some characters have different meanings based on the context
(unary_operation "!" @operator)
(binary_operation "." @operator)
2021-08-16 17:19:35 +02:00
2022-11-21 11:00:23 +00:00
2021-08-16 17:19:35 +02:00
;; Punctuation
[
"("
")"
"{"
"}"
"["
"]"
2022-11-21 11:00:23 +00:00
"#{"
2021-08-16 17:19:35 +02:00
] @punctuation.bracket
(field_expression "." @punctuation.delimiter)
2021-08-20 13:35:04 -05:00
[
","
":"
] @punctuation.delimiter
(ternary_expression ["?" ":"] @conditional.ternary)
2021-08-20 13:35:04 -05:00
; Options
((set_value) @number
2023-04-21 04:06:20 -04:00
(#lua-match? @number "^[%d]+(%.[%d]+)?$"))
2021-09-25 00:17:46 -05:00
2022-11-21 11:00:23 +00:00
(inv_option "!" @operator)
(set_item "?" @operator)
2021-09-25 00:17:46 -05:00
((set_item
option: (option_name) @_option
value: (set_value) @function)
(#any-of? @_option
"tagfunc" "tfu"
"completefunc" "cfu"
"omnifunc" "ofu"
"operatorfunc" "opfunc"))