2022-09-04 07:37:24 -07:00
|
|
|
((function_call
|
2024-01-17 08:55:52 -07:00
|
|
|
name:
|
|
|
|
[
|
|
|
|
(identifier) @_cdef_identifier
|
|
|
|
(_
|
|
|
|
_
|
|
|
|
(identifier) @_cdef_identifier)
|
|
|
|
]
|
2023-06-26 00:25:46 -07:00
|
|
|
arguments:
|
|
|
|
(arguments
|
2024-01-17 08:55:52 -07:00
|
|
|
(string
|
|
|
|
content: _ @injection.content)))
|
2023-03-08 04:03:11 -07:00
|
|
|
(#set! injection.language "c")
|
2022-09-04 07:37:24 -07:00
|
|
|
(#eq? @_cdef_identifier "cdef"))
|
|
|
|
|
|
|
|
((function_call
|
|
|
|
name: (_) @_vimcmd_identifier
|
2024-01-17 08:55:52 -07:00
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
(string
|
|
|
|
content: _ @injection.content)))
|
2023-03-08 04:03:11 -07:00
|
|
|
(#set! injection.language "vim")
|
2023-06-26 00:25:46 -07:00
|
|
|
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
|
2023-05-13 03:37:22 -07:00
|
|
|
|
2023-03-03 06:27:30 -07:00
|
|
|
((function_call
|
|
|
|
name: (_) @_vimcmd_identifier
|
2024-01-17 08:55:52 -07:00
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
(string
|
|
|
|
content: _ @injection.content) .))
|
2023-03-08 04:03:11 -07:00
|
|
|
(#set! injection.language "query")
|
2023-03-31 07:11:17 -07:00
|
|
|
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
2022-09-04 07:37:24 -07:00
|
|
|
|
2023-06-26 00:25:46 -07:00
|
|
|
((function_call
|
|
|
|
name: (_) @_vimcmd_identifier
|
2024-01-17 08:55:52 -07:00
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
.
|
|
|
|
(_)
|
|
|
|
.
|
|
|
|
(string
|
|
|
|
content: _ @_method)
|
|
|
|
.
|
|
|
|
(string
|
|
|
|
content: _ @injection.content)))
|
2023-06-26 00:25:46 -07:00
|
|
|
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
|
|
|
(#eq? @_method "nvim_exec_lua")
|
|
|
|
(#set! injection.language "lua"))
|
|
|
|
|
2024-01-17 08:55:52 -07:00
|
|
|
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
|
|
|
|
(function_call
|
|
|
|
name: (_) @_vimcmd_identifier
|
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
.
|
|
|
|
(_)
|
|
|
|
.
|
|
|
|
(table_constructor
|
|
|
|
(field
|
|
|
|
name: (identifier) @_command
|
|
|
|
value:
|
|
|
|
(string
|
|
|
|
content: (_) @injection.content))) .)
|
|
|
|
; limit so only 2-argument functions gets matched before pred handle
|
|
|
|
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
|
|
|
|
(#eq? @_command "command")
|
|
|
|
(#set! injection.language "vim"))
|
|
|
|
|
|
|
|
(function_call
|
|
|
|
name: (_) @_user_cmd
|
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
.
|
|
|
|
(_)
|
|
|
|
.
|
|
|
|
(string
|
|
|
|
content: (_) @injection.content)
|
|
|
|
.
|
|
|
|
(_) .)
|
|
|
|
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
|
|
|
|
(#set! injection.language "vim"))
|
|
|
|
|
|
|
|
(function_call
|
|
|
|
name: (_) @_user_cmd
|
|
|
|
arguments:
|
|
|
|
(arguments
|
|
|
|
.
|
|
|
|
(_)
|
|
|
|
.
|
|
|
|
(_)
|
|
|
|
.
|
|
|
|
(string
|
|
|
|
content: (_) @injection.content)
|
|
|
|
.
|
|
|
|
(_) .)
|
|
|
|
; Limiting predicate handling to only functions with 4 arguments
|
|
|
|
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
|
|
|
(#set! injection.language "vim"))
|
2022-09-04 07:37:24 -07:00
|
|
|
|
2024-01-17 08:55:52 -07:00
|
|
|
; rhs highlighting for vim.keymap.set/vim.api.nvim_set_keymap/vim.api.nvim_buf_set_keymap
|
|
|
|
; (function_call
|
|
|
|
; name: (_) @_map
|
|
|
|
; arguments:
|
|
|
|
; (arguments
|
|
|
|
; . (_)
|
|
|
|
; . (_)
|
|
|
|
; .
|
|
|
|
; (string
|
|
|
|
; content: (_) @injection.content))
|
|
|
|
; (#any-of? @_map "vim.api.nvim_set_keymap" "vim.keymap.set")
|
|
|
|
; (#set! injection.language "vim"))
|
|
|
|
;
|
|
|
|
; (function_call
|
|
|
|
; name: (_) @_map
|
|
|
|
; arguments:
|
|
|
|
; (arguments
|
|
|
|
; . (_)
|
|
|
|
; . (_)
|
|
|
|
; . (_)
|
|
|
|
; .
|
|
|
|
; (string
|
|
|
|
; content: (_) @injection.content)
|
|
|
|
; . (_) .)
|
|
|
|
; (#eq? @_map "vim.api.nvim_buf_set_keymap")
|
|
|
|
; (#set! injection.language "vim"))
|
|
|
|
; highlight string as query if starts with `;; query`
|
|
|
|
(string
|
|
|
|
content: _ @injection.content
|
|
|
|
(#lua-match? @injection.content "^%s*;+%s?query")
|
|
|
|
(#set! injection.language "query"))
|