From f65513928127ec4e2e4187af36ec49255bd0f5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=BAc=20H=2E=20L=C3=AA=20Kh=E1=BA=AFc?= Date: Tue, 19 Mar 2024 21:31:00 +0000 Subject: [PATCH] feat(mini.ai): add more objects d,e,g,u,U (#2769) --- lua/lazyvim/plugins/coding.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 662977f0..6b30614d 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -212,6 +212,26 @@ return { f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}), c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}), t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, + d = { "%f[%d]%d+" }, -- digits + e = { -- Word with case + { + "%u[%l%d]+%f[^%l%d]", + "%f[%S][%l%d]+%f[^%l%d]", + "%f[%P][%l%d]+%f[^%l%d]", + "^[%l%d]+%f[^%l%d]", + }, + "^().*()$", + }, + g = function() -- Whole buffer, similar to `gg` and 'G' motion + local from = { line = 1, col = 1 } + local to = { + line = vim.fn.line("$"), + col = math.max(vim.fn.getline("$"):len(), 1), + } + return { from = from, to = to } + end, + u = ai.gen_spec.function_call(), -- u for "Usage" + U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name }, } end, @@ -238,10 +258,15 @@ return { a = "Argument", b = "Balanced ), ], }", c = "Class", + d = "Digit(s)", + e = "Word in CamelCase & snake_case", f = "Function", + g = "Entire file", o = "Block, conditional, loop", q = "Quote `, \", '", t = "Tag", + u = "Use/call function & method", + U = "Use/call without dot in name", } local a = vim.deepcopy(i) for k, v in pairs(a) do