Viml: update queries

This commit is contained in:
Santos Gallegos 2021-08-20 13:35:04 -05:00 committed by Thomas Vigouroux
parent 012e2161e3
commit 79a0230dbd
2 changed files with 36 additions and 4 deletions

View file

@ -1,3 +1,7 @@
(identifier) @variable
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
;; Keywords
[
@ -31,13 +35,16 @@
;; Function related
(function_declaration name: (_) @function)
(call_expression function: (identifier) @function)
(function_declaration parameters: (parameters (identifier) @parameter))
[ (bang) (spread) ] @punctuation.special
[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
[ (scope) "a:" ] @namespace
(ternary_expression ["?" ":"] @conditional)
[
(scope)
"a:"
"$"
] @namespace
;; Commands and user defined commands
@ -83,12 +90,17 @@
(float_literal) @float
(comment) @comment
(pattern) @string.special
((scoped_identifier
(scope) @_scope . (identifier) @boolean)
(#eq? @_scope "v:")
(#any-of? @boolean "true" "false"))
;; Operators
[
"||"
"&&"
"&"
"+"
"-"
"*"
@ -130,4 +142,14 @@
] @punctuation.bracket
(field_expression "." @punctuation.delimiter)
"," @punctuation.delimiter
[
","
":"
] @punctuation.delimiter
(ternary_expression ["?" ":"] @conditional)
; Options
((set_value) @number
(#match? @number "^[0-9]+(\.[0-9]+)?$"))

10
queries/vim/locals.scm Normal file
View file

@ -0,0 +1,10 @@
[
(script_file)
(function_definition)
] @scope
(function_declaration name: (identifier) @definition.function)
(function_declaration parameters: (parameters (identifier) @definition.parameter))
(let_statement [(scoped_identifier) (identifier)] @definition.var)
(identifier) @reference