mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-09 06:50:06 -04:00
feat: add support for vim
This commit is contained in:
parent
9c5dd185c4
commit
1877e03bfa
4 changed files with 124 additions and 0 deletions
105
queries/vim/highlights.scm
Normal file
105
queries/vim/highlights.scm
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
;; Keywords
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"elseif"
|
||||
"endif"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"finally"
|
||||
"endtry"
|
||||
"throw"
|
||||
] @exception
|
||||
|
||||
[
|
||||
"for"
|
||||
"endfor"
|
||||
"in"
|
||||
"while"
|
||||
"endwhile"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"function"
|
||||
"endfunction"
|
||||
] @keyword.function
|
||||
|
||||
;; Function related
|
||||
(function_declaration name: (_) @function)
|
||||
(call_expression function: (identifier) @function)
|
||||
|
||||
[ (bang) (spread) ] @punctuation.special
|
||||
|
||||
[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
|
||||
[ (scope) "a:" ] @namespace
|
||||
|
||||
(ternary_expression ["?" ":"] @conditional)
|
||||
|
||||
;; Commands and user defined commands
|
||||
|
||||
[
|
||||
"let"
|
||||
"unlet"
|
||||
"call"
|
||||
"execute"
|
||||
"normal"
|
||||
"set"
|
||||
"silent"
|
||||
"echo"
|
||||
"autocmd"
|
||||
"return"
|
||||
"lua"
|
||||
"ruby"
|
||||
"perl"
|
||||
"python"
|
||||
] @keyword
|
||||
(command_name) @function.macro
|
||||
|
||||
(au_event) @constant
|
||||
(normal_statement (commands) @constant)
|
||||
|
||||
;; Literals
|
||||
|
||||
(string_literal) @string
|
||||
(integer_literal) @number
|
||||
(float_literal) @float
|
||||
(comment) @comment
|
||||
(pattern) @string.special
|
||||
|
||||
;; Operators
|
||||
|
||||
[
|
||||
"||"
|
||||
"&&"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
".."
|
||||
"is"
|
||||
"isnot"
|
||||
"=="
|
||||
"!="
|
||||
">"
|
||||
">="
|
||||
"<"
|
||||
"<="
|
||||
"=~"
|
||||
"!~"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
".="
|
||||
] @operator
|
||||
|
||||
; Some characters have different meanings based on the context
|
||||
(unary_operation "!" @operator)
|
||||
(binary_operation "." @operator)
|
||||
9
queries/vim/injections.scm
Normal file
9
queries/vim/injections.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(lua_statement . (_) @lua)
|
||||
(ruby_statement . (_) @ruby)
|
||||
(python_statement . (_) @python)
|
||||
;; If we support perl at some point...
|
||||
;; (perl_statement . (_) @perl)
|
||||
|
||||
(autocmd_statement (pattern) @regex)
|
||||
|
||||
(comment) @comment
|
||||
Loading…
Add table
Add a link
Reference in a new issue