From 011ac894ec5b9e36563d8629fb7734f43ddb27a8 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 18 Nov 2021 09:51:03 +0000 Subject: Prefer lua-match over match as string.find is much quicker than vim.regex:match* --- queries/lua/highlights.scm | 2 +- queries/lua/injections.scm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'queries/lua') diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 842ed64d..2c7291b9 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -116,7 +116,7 @@ (nil) @constant.builtin (spread) @constant ;; "..." ((identifier) @constant - (#match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) ;; Functions (function [(function_name) (identifier)] @function) diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm index 65b8b304..fa05c40a 100644 --- a/queries/lua/injections.scm +++ b/queries/lua/injections.scm @@ -8,7 +8,7 @@ ) (#eq? @_cdef_identifier "cdef") - (#match? @c "^[\"']") + (#lua-match? @c "^[\"']") (#offset! @c 0 1 0 -1) ) @@ -21,7 +21,7 @@ ) (#eq? @_cdef_identifier "cdef") - (#match? @c "^\\[\\[") + (#lua-match? @c "^%[%[") (#offset! @c 0 2 0 -2) ) @@ -34,7 +34,7 @@ ) (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec") - (#match? @vim "^[\"']") + (#lua-match? @vim "^[\"']") (#offset! @vim 0 1 0 -1) ) @@ -46,7 +46,7 @@ ) (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec") - (#match? @vim "^\\[\\[") + (#lua-match? @vim "^%[%[") (#offset! @vim 0 2 0 -2) ) -- cgit v1.2.3