Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
(identifier) @variable
;; Function related
(function_declaration name: (_) @function (#set! "priority" 101))
(call_expression function: (identifier) @function (#set! "priority" 101))
(parameters (identifier) @parameter (#set! "priority" 101))
(default_parameter (identifier) @parameter (#set! "priority" 101))

;; Command command

(command) @string

(command_attribute
name: _ @property
val: (behavior
name: _ @constant (#set! "priority" 101)
val: (identifier)? @function (#set! "priority" 101))?)


((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(#match? @constant "^[A-Z][A-Z_0-9]*$")
(#set! "priority" 101))
(identifier) @variable

;; Keywords

Expand Down Expand Up @@ -34,12 +52,6 @@
"endfunction"
] @keyword.function

;; Function related
(function_declaration name: (_) @function)
(call_expression function: (identifier) @function)
(parameters (identifier) @parameter)
(default_parameter (identifier) @parameter)

[ (bang) (spread) ] @punctuation.special

[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
Expand Down Expand Up @@ -163,16 +175,6 @@
"clear"
] @keyword)

;; Command command

(command) @string

(command_attribute
name: _ @property
val: (behavior
name: _ @constant
val: (identifier)? @function)?)

;; Edit command
(plus_plus_opt
val: _? @constant) @property
Expand Down
39 changes: 35 additions & 4 deletions test/highlight/commands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,41 @@ command -buffer -bar -bang -keepscript -register UserCommand echo
" ^ function.macro
" ^ string

" command UserCommand call Test()
command UserCommand call Test()
" <- keyword
" ^^^^^^^^^^^ function.macro
" ^^^^^^^^^^^ string

" command -complete=syntax ToggleSyntax if exists("g:syntax_on") | syntax off | else | syntax enable | endif
command -complete=syntax ToggleSyntax if exists("g:syntax_on") | syntax off | else | syntax enable | endif
" <- keyword
" ^^^^^^^^^ property
" ^ operator
" ^^^^^^ constant
" ^^^^^^^^^^^^ function.macro
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string

" command -nargs=1 -complete=mapping Show echo "this is an error message"
command -nargs=1 -complete=mapping Show echo "this is an error message"
" <- keyword
" ^^^^^^ property
" ^ operator
" ^ number
" ^^^^^^^^^ property
" ^ operator
" ^^^^^^^ constant
" ^^^^ function.macro
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string

" com -complete=custom,funcName -buffer -addr=tabs -bang ShowFunc execute "echo 'this is another error message'"
com -complete=custom,funcName -buffer -addr=tabs -bang ShowFunc execute "echo 'this is another error message'"
" <- keyword
" ^^^^^^^^^ property
" ^ operator
" ^^^^^^ constant
" ^ punctuation.delimiter
" ^^^^^^^^ function
" ^^^^^^^ property
" ^^^^^ property
" ^ operator
" ^^^^ constant
" ^^^^^ property
" ^^^^^^^^ function.macro
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string
8 changes: 8 additions & 0 deletions test/highlight/eval.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

eval append(foo, 0)
" <- keyword
" ^^^^^^ function
" ^ punctuation.bracket
" ^^^ variable
" ^ number
" ^ punctuation.bracket

call Of(DUTY)
" <- keyword
" ^^ function
" ^ punctuation.bracket
" ^^^^ constant
" ^ punctuation.bracket