diff options
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/treesitter/query.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua index 55e69f177f..46b54ad079 100644 --- a/runtime/lua/vim/treesitter/query.lua +++ b/runtime/lua/vim/treesitter/query.lua @@ -60,7 +60,7 @@ local predicate_handlers = { return true end, - ["match?"] = function(match, _, bufnr, predicate) + ["lua-match?"] = function(match, _, bufnr, predicate) local node = match[predicate[2]] local regex = predicate[3] local start_row, _, end_row, _ = node:range() @@ -71,7 +71,7 @@ local predicate_handlers = { return string.find(M.get_node_text(node, bufnr), regex) end, - ["vim-match?"] = (function() + ["match?"] = (function() local magic_prefixes = {['\\v']=true, ['\\m']=true, ['\\M']=true, ['\\V']=true} local function check_magic(str) if string.len(str) < 2 or magic_prefixes[string.sub(str,1,2)] then @@ -114,6 +114,9 @@ local predicate_handlers = { end } +-- As we provide lua-match? also expose vim-match? +predicate_handlers["vim-match?"] = predicate_handlers["match?"] + --- Adds a new predicates to be used in queries -- -- @param name the name of the predicate, without leading # |