diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 86b4bdd8..dc470791 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -160,7 +160,6 @@ return { { "%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]" }, "^().*()$", }, - i = LazyVim.mini.ai_indent, -- indent g = LazyVim.mini.ai_buffer, -- buffer u = ai.gen_spec.function_call(), -- u for "Usage" U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name diff --git a/lua/lazyvim/plugins/init.lua b/lua/lazyvim/plugins/init.lua index 8c55e992..af04f699 100644 --- a/lua/lazyvim/plugins/init.lua +++ b/lua/lazyvim/plugins/init.lua @@ -35,6 +35,7 @@ return { quickfile = { enabled = true }, statuscolumn = { enabled = false }, -- we set this in options.lua scroll = { enabled = true }, + scope = { enabled = true }, indent = { enabled = true }, terminal = { win = { diff --git a/lua/lazyvim/util/mini.lua b/lua/lazyvim/util/mini.lua index 28d38f5b..e6f0d082 100644 --- a/lua/lazyvim/util/mini.lua +++ b/lua/lazyvim/util/mini.lua @@ -1,47 +1,6 @@ ---@class lazyvim.util.mini local M = {} ----@alias Mini.ai.loc {line:number, col:number} ----@alias Mini.ai.region {from:Mini.ai.loc, to:Mini.ai.loc} - --- Mini.ai indent text object --- For "a", it will include the non-whitespace line surrounding the indent block. --- "a" is line-wise, "i" is character-wise. -function M.ai_indent(ai_type) - local spaces = (" "):rep(vim.o.tabstop) - local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) - local indents = {} ---@type {line: number, indent: number, text: string}[] - - for l, line in ipairs(lines) do - if not line:find("^%s*$") then - indents[#indents + 1] = { line = l, indent = #line:gsub("\t", spaces):match("^%s*"), text = line } - end - end - - local ret = {} ---@type (Mini.ai.region | {indent: number})[] - - for i = 1, #indents do - if i == 1 or indents[i - 1].indent < indents[i].indent then - local from, to = i, i - for j = i + 1, #indents do - if indents[j].indent < indents[i].indent then - break - end - to = j - end - from = ai_type == "a" and from > 1 and from - 1 or from - to = ai_type == "a" and to < #indents and to + 1 or to - ret[#ret + 1] = { - indent = indents[i].indent, - from = { line = indents[from].line, col = ai_type == "a" and 1 or indents[from].indent + 1 }, - to = { line = indents[to].line, col = #indents[to].text }, - } - end - end - - return ret -end - -- taken from MiniExtra.gen_ai_spec.buffer function M.ai_buffer(ai_type) local start_line, end_line = 1, vim.fn.line("$") @@ -92,6 +51,7 @@ function M.ai_whichkey(opts) { "}", desc = "{} with ws" }, } + ---@type wk.Spec[] local ret = { mode = { "o", "x" } } ---@type table local mappings = vim.tbl_extend("force", {}, {