summaryrefslogtreecommitdiffstats
path: root/queries/vim
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/vim
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/vim')
-rw-r--r--queries/vim/folds.scm4
-rw-r--r--queries/vim/highlights.scm234
-rw-r--r--queries/vim/injections.scm60
-rw-r--r--queries/vim/locals.scm16
4 files changed, 186 insertions, 128 deletions
diff --git a/queries/vim/folds.scm b/queries/vim/folds.scm
index 4c9973583..0a1fb695f 100644
--- a/queries/vim/folds.scm
+++ b/queries/vim/folds.scm
@@ -1,4 +1,4 @@
[
- (if_statement)
- (function_definition)
+ (if_statement)
+ (function_definition)
] @fold
diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm
index 7b28b4759..67f8546b0 100644
--- a/queries/vim/highlights.scm
+++ b/queries/vim/highlights.scm
@@ -1,9 +1,9 @@
(identifier) @variable
-((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
-;; Keywords
+((identifier) @constant
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+; Keywords
[
"if"
"else"
@@ -34,24 +34,43 @@
"endfunction"
] @keyword.function
-;; Function related
-(function_declaration name: (_) @function)
-(call_expression function: (identifier) @function.call)
-(call_expression function: (scoped_identifier (identifier) @function.call))
-(parameters (identifier) @variable.parameter)
-(default_parameter (identifier) @variable.parameter)
+; Function related
+(function_declaration
+ name: (_) @function)
+
+(call_expression
+ function: (identifier) @function.call)
+
+(call_expression
+ function:
+ (scoped_identifier
+ (identifier) @function.call))
+
+(parameters
+ (identifier) @variable.parameter)
-[ (bang) (spread) ] @punctuation.special
+(default_parameter
+ (identifier) @variable.parameter)
+
+[
+ (bang)
+ (spread)
+] @punctuation.special
+
+[
+ (no_option)
+ (inv_option)
+ (default_option)
+ (option_name)
+] @variable.builtin
-[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
[
(scope)
"a:"
"$"
] @module
-;; Commands and user defined commands
-
+; Commands and user defined commands
[
"let"
"unlet"
@@ -109,40 +128,46 @@
"eval"
"sign"
] @keyword
-(map_statement cmd: _ @keyword)
-(command_name) @function.macro
-;; Filetype command
+(map_statement
+ cmd: _ @keyword)
+
+(command_name) @function.macro
-(filetype_statement [
- "detect"
- "plugin"
- "indent"
- "on"
- "off"
-] @keyword)
+; Filetype command
+(filetype_statement
+ [
+ "detect"
+ "plugin"
+ "indent"
+ "on"
+ "off"
+ ] @keyword)
-;; Syntax command
+; Syntax command
+(syntax_statement
+ (keyword) @string)
-(syntax_statement (keyword) @string)
-(syntax_statement [
- "enable"
- "on"
- "off"
- "reset"
- "case"
- "spell"
- "foldlevel"
- "iskeyword"
- "keyword"
- "match"
- "cluster"
- "region"
- "clear"
- "include"
-] @keyword)
+(syntax_statement
+ [
+ "enable"
+ "on"
+ "off"
+ "reset"
+ "case"
+ "spell"
+ "foldlevel"
+ "iskeyword"
+ "keyword"
+ "match"
+ "cluster"
+ "region"
+ "clear"
+ "include"
+ ] @keyword)
-(syntax_argument name: _ @keyword)
+(syntax_argument
+ name: _ @keyword)
[
"<buffer>"
@@ -156,70 +181,92 @@
(augroup_name) @module
(au_event) @constant
-(normal_statement (commands) @constant)
-;; Highlight command
+(normal_statement
+ (commands) @constant)
+; Highlight command
(hl_attribute
key: _ @property
val: _ @constant)
(hl_group) @type
-(highlight_statement [
- "default"
- "link"
- "clear"
-] @keyword)
-
-;; Command command
+(highlight_statement
+ [
+ "default"
+ "link"
+ "clear"
+ ] @keyword)
+; Command command
(command) @string
(command_attribute
name: _ @property
- val: (behavior
- name: _ @constant
- val: (identifier)? @function)?)
+ val:
+ (behavior
+ name: _ @constant
+ val: (identifier)? @function)?)
-;; Edit command
+; Edit command
(plus_plus_opt
val: _? @constant) @property
-(plus_cmd "+" @property) @property
-
-;; Runtime command
-
-(runtime_statement (where) @keyword.operator)
-
-;; Colorscheme command
-(colorscheme_statement (name) @string)
+(plus_cmd
+ "+" @property) @property
-;; Scriptencoding command
+; Runtime command
+(runtime_statement
+ (where) @keyword.operator)
-(scriptencoding_statement (encoding) @string.special)
+; Colorscheme command
+(colorscheme_statement
+ (name) @string)
-;; Literals
+; Scriptencoding command
+(scriptencoding_statement
+ (encoding) @string.special)
+; Literals
(string_literal) @string
+
(integer_literal) @number
+
(float_literal) @number.float
+
(comment) @comment @spell
+
(line_continuation_comment) @comment @spell
+
(pattern) @string.special
+
(pattern_multi) @string.regexp
+
(filename) @string.special.path
-(heredoc (body) @string)
-(heredoc (parameter) @keyword)
-[ (marker_definition) (endmarker) ] @label
-(literal_dictionary (literal_key) @label)
-((scoped_identifier
- (scope) @_scope . (identifier) @boolean)
- (#eq? @_scope "v:")
- (#any-of? @boolean "true" "false"))
-;; Operators
+(heredoc
+ (body) @string)
+(heredoc
+ (parameter) @keyword)
+
+[
+ (marker_definition)
+ (endmarker)
+] @label
+
+(literal_dictionary
+ (literal_key) @label)
+
+((scoped_identifier
+ (scope) @_scope
+ .
+ (identifier) @boolean)
+ (#eq? @_scope "v:")
+ (#any-of? @boolean "true" "false"))
+
+; Operators
[
"||"
"&&"
@@ -254,12 +301,13 @@
] @operator
; Some characters have different meanings based on the context
-(unary_operation "!" @operator)
-(binary_operation "." @operator)
+(unary_operation
+ "!" @operator)
+(binary_operation
+ "." @operator)
-;; Punctuation
-
+; Punctuation
[
"("
")"
@@ -270,27 +318,31 @@
"#{"
] @punctuation.bracket
-(field_expression "." @punctuation.delimiter)
+(field_expression
+ "." @punctuation.delimiter)
[
","
":"
] @punctuation.delimiter
-(ternary_expression ["?" ":"] @keyword.conditional.ternary)
+(ternary_expression
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
; Options
((set_value) @number
- (#lua-match? @number "^[%d]+(%.[%d]+)?$"))
+ (#lua-match? @number "^[%d]+(%.[%d]+)?$"))
+
+(inv_option
+ "!" @operator)
-(inv_option "!" @operator)
-(set_item "?" @operator)
+(set_item
+ "?" @operator)
((set_item
- option: (option_name) @_option
- value: (set_value) @function)
- (#any-of? @_option
- "tagfunc" "tfu"
- "completefunc" "cfu"
- "omnifunc" "ofu"
- "operatorfunc" "opfunc"))
+ option: (option_name) @_option
+ value: (set_value) @function)
+ (#any-of? @_option "tagfunc" "tfu" "completefunc" "cfu" "omnifunc" "ofu" "operatorfunc" "opfunc"))
diff --git a/queries/vim/injections.scm b/queries/vim/injections.scm
index 553ac5e6a..c76feddb4 100644
--- a/queries/vim/injections.scm
+++ b/queries/vim/injections.scm
@@ -1,46 +1,42 @@
-(lua_statement
- (script
+(lua_statement
+ (script
(body) @injection.content
(#set! injection.language "lua")))
-(lua_statement
+
+(lua_statement
(chunk) @injection.content
(#set! injection.language "lua"))
-(ruby_statement
- (script
- (body) @injection.content
+
+(ruby_statement
+ (script
+ (body) @injection.content
(#set! injection.language "ruby")))
-(ruby_statement
- (chunk) @injection.content
+
+(ruby_statement
+ (chunk) @injection.content
(#set! injection.language "ruby"))
-(python_statement
- (script
- (body) @injection.content
+
+(python_statement
+ (script
+ (body) @injection.content
(#set! injection.language "python")))
-(python_statement
- (chunk) @injection.content
+
+(python_statement
+ (chunk) @injection.content
(#set! injection.language "python"))
-;; If we support perl at some point...
-;; (perl_statement (script (body) @perl))
-;; (perl_statement (chunk) @perl)
-(autocmd_statement
- (pattern) @injection.content
+; If we support perl at some point...
+; (perl_statement (script (body) @perl))
+; (perl_statement (chunk) @perl)
+(autocmd_statement
+ (pattern) @injection.content
(#set! injection.language "regex"))
((set_item
- option: (option_name) @_option
- value: (set_value) @injection.content)
- (#any-of? @_option
- "includeexpr" "inex"
- "printexpr" "pexpr"
- "formatexpr" "fex"
- "indentexpr" "inde"
- "foldtext" "fdt"
- "foldexpr" "fde"
- "diffexpr" "dex"
- "patchexpr" "pex"
- "charconvert" "ccv")
+ option: (option_name) @_option
+ value: (set_value) @injection.content)
+ (#any-of? @_option "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt" "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv")
(#set! injection.language "vim"))
-((comment) @injection.content
- (#set! injection.language "comment"))
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/vim/locals.scm b/queries/vim/locals.scm
index 4ba551e40..dff662680 100644
--- a/queries/vim/locals.scm
+++ b/queries/vim/locals.scm
@@ -3,8 +3,18 @@
(function_definition)
] @local.scope
-(function_declaration name: (identifier) @local.definition.function)
-(function_declaration parameters: (parameters (identifier) @local.definition.parameter))
-(let_statement [(scoped_identifier) (identifier)] @local.definition.var)
+(function_declaration
+ name: (identifier) @local.definition.function)
+
+(function_declaration
+ parameters:
+ (parameters
+ (identifier) @local.definition.parameter))
+
+(let_statement
+ [
+ (scoped_identifier)
+ (identifier)
+ ] @local.definition.var)
(identifier) @local.reference