From 51ee1aebf5d60124fe9b615688ff4838bcb56dd7 Mon Sep 17 00:00:00 2001 From: caprain Date: Mon, 13 Apr 2026 16:33:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/pack/configs/autopairs.lua | 22 ++++++++ lua/pack/configs/blinkcmp.lua | 5 +- lua/pack/configs/bufferline.lua | 5 +- lua/pack/configs/coderunner.lua | 77 ++++++++++++++-------------- lua/pack/configs/conform.lua | 5 +- lua/pack/configs/indentblankline.lua | 5 +- lua/pack/configs/lspconfig.lua | 1 - lua/pack/configs/mini.lua | 38 ++++++++++++++ lua/pack/configs/noice.lua | 74 ++++++++++++-------------- lua/pack/configs/peek.lua | 36 ++++++------- lua/pack/configs/snacks.lua | 5 +- lua/pack/configs/treesitter.lua | 1 - lua/pack/configs/tv.lua | 7 ++- lua/pack/configs/ufo.lua | 7 ++- lua/pack/configs/yazi.lua | 5 +- lua/pack/plugins.lua | 34 ++++++------ nvim-pack-lock.json | 8 +++ snippets/lua.json | 27 ++++------ 18 files changed, 200 insertions(+), 162 deletions(-) create mode 100644 lua/pack/configs/autopairs.lua create mode 100644 lua/pack/configs/mini.lua diff --git a/lua/pack/configs/autopairs.lua b/lua/pack/configs/autopairs.lua new file mode 100644 index 0000000..18ee50c --- /dev/null +++ b/lua/pack/configs/autopairs.lua @@ -0,0 +1,22 @@ +-- === 对字符自动补全另一半 === +if vim.g.vscode then return end + +local P = { + name = "nvim-autopairs", -- 仓库名 +} + +-- 懒加载触发器 +vim.api.nvim_create_autocmd({ + "InsertEnter", "CmdlineEnter", -- 补全/命令行 +}, { + callback = function() + PackUtils.load(P, function() + require('nvim-autopairs').setup({ + -- 在写markdown时禁用括号补全 + disable_filetype = { "markdown" }, + -- can use treesitter to check for a pair. + check_ts = true, + }) + end) + end +}) diff --git a/lua/pack/configs/blinkcmp.lua b/lua/pack/configs/blinkcmp.lua index 4bf75cf..cc7d912 100644 --- a/lua/pack/configs/blinkcmp.lua +++ b/lua/pack/configs/blinkcmp.lua @@ -3,7 +3,6 @@ if vim.g.vscode then return end local P = { name = "blink.cmp", - module = "blink.cmp", deps = { "friendly-snippets" }, -- build_cmd = "cargo build --release", } @@ -14,8 +13,8 @@ vim.api.nvim_create_autocmd({ "InsertEnter", "CmdlineEnter", "LspAttach" }, { once = true, callback = function() -- 调用引擎的 load 方法,把 setup 逻辑作为匿名函数传进去 - PackUtils.load(P, function(plugin) - plugin.setup({ + PackUtils.load(P, function() + require("blink.cmp").setup({ fuzzy = { prebuilt_binaries = { force_version = 'v*', diff --git a/lua/pack/configs/bufferline.lua b/lua/pack/configs/bufferline.lua index b6e56fc..73af904 100644 --- a/lua/pack/configs/bufferline.lua +++ b/lua/pack/configs/bufferline.lua @@ -9,7 +9,6 @@ if vim.g.vscode then return end local P = { name = "bufferline.nvim", - module = "bufferline", deps = { "nvim-web-devicons" }, -- 确保图标库先加载 } @@ -17,7 +16,7 @@ local P = { vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { once = true, callback = function() - PackUtils.load(P, function(plugin) + PackUtils.load(P, function() -- 在缓冲区之间移动 map:cmd('tn', 'BufferLineCyclePrev') map:cmd('ti', 'BufferLineCycleNext') @@ -30,7 +29,7 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { map:cmd('tN', 'BufferLineCloseLeft') map:cmd('tI', 'BufferLineCloseRight') map:cmd('tQ', 'BufferLineCloseOthers') - plugin.setup({ + require("bufferline").setup({ options = { modified_icon = "", buffer_close_icon = "×", diff --git a/lua/pack/configs/coderunner.lua b/lua/pack/configs/coderunner.lua index b01e6ba..0878a18 100644 --- a/lua/pack/configs/coderunner.lua +++ b/lua/pack/configs/coderunner.lua @@ -1,53 +1,52 @@ if vim.g.vscode then return end local P = { - name = "code_runner.nvim", - module = "code_runner", - deps = {}, + name = "code_runner.nvim", + deps = {}, } -- 定义映射配置表 local mappings = { - { ft = { "rust", "python" }, cmd = "RunCode", desc = "Save and Run Code" }, - { ft = "markdown", cmd = "PeekClose;PeekOpen", desc = "Reload Markdown Preview" }, - { ft = "dart", cmd = "Telescope flutter commands", desc = "Open Flutter Commands" }, - { ft = "go", cmd = "set splitbelow;sp;term go run %", desc = "Run Go file" }, + { ft = { "rust", "python" }, cmd = "RunCode", desc = "Save and Run Code" }, + { ft = "markdown", cmd = "PeekClose;PeekOpen", desc = "Reload Markdown Preview" }, + { ft = "dart", cmd = "Telescope flutter commands", desc = "Open Flutter Commands" }, + { ft = "go", cmd = "set splitbelow;sp;term go run %", desc = "Run Go file" }, } -- 只有进入这些文件类型时,才会为当前 buffer 绑定 r 键 local ft_group = vim.api.nvim_create_augroup("CodeRunnerLazy", { clear = true }) for _, entry in ipairs(mappings) do - vim.api.nvim_create_autocmd("FileType", { - pattern = entry.ft, - group = ft_group, - callback = function(args) - -- 为当前 buffer 绑定 r 键 - vim.keymap.set("n", "r", function() - if vim.bo.modified then vim.cmd("wall") end - -- 只有命令中包含 "RunCode" 时,才加载代码运行器插件 - if string.find(entry.cmd, "RunCode") then - PackUtils.load(P, function(plugin) - plugin.setup({ - -- project = { - -- ["~/sixsixsix"] = { - -- name = "sixsixsix", - -- description = "六爻网页排盘", - -- command = "cargo run --release" - -- }, - -- }, - filetype = { - python = "uv run $fileName", - rust = { "cargo run --release" }, - }, - }) - end) - end - -- 处理多条命令的情况 (用分号分隔) - for c in string.gmatch(entry.cmd, "[^;]+") do - vim.cmd(c) - end - end, { buffer = args.buf, desc = entry.desc, silent = true }) - end, - }) + vim.api.nvim_create_autocmd("FileType", { + pattern = entry.ft, + group = ft_group, + callback = function(args) + -- 为当前 buffer 绑定 r 键 + vim.keymap.set("n", "r", function() + if vim.bo.modified then vim.cmd("wall") end + -- 只有命令中包含 "RunCode" 时,才加载代码运行器插件 + if string.find(entry.cmd, "RunCode") then + PackUtils.load(P, function() + require("code_runner").setup({ + -- project = { + -- ["~/sixsixsix"] = { + -- name = "sixsixsix", + -- description = "六爻网页排盘", + -- command = "cargo run --release" + -- }, + -- }, + filetype = { + python = "uv run $fileName", + rust = { "cargo run --release" }, + }, + }) + end) + end + -- 处理多条命令的情况 (用分号分隔) + for c in string.gmatch(entry.cmd, "[^;]+") do + vim.cmd(c) + end + end, { buffer = args.buf, desc = entry.desc, silent = true }) + end, + }) end diff --git a/lua/pack/configs/conform.lua b/lua/pack/configs/conform.lua index 42c6ab2..8f8366c 100644 --- a/lua/pack/configs/conform.lua +++ b/lua/pack/configs/conform.lua @@ -3,7 +3,6 @@ if vim.g.vscode then return end local P = { name = "conform.nvim", - module = "conform", deps = { "mason.nvim", "mason-registry", @@ -43,8 +42,8 @@ end -- 快捷键纯懒加载:只在按下快捷键时激活 vim.keymap.set({ "n", "v" }, "f", function() - PackUtils.load(P, function(plugin) - plugin.setup({ -- At a minimum, you will need to set up some formatters by filetype + PackUtils.load(P, function() + require("conform").setup({ -- At a minimum, you will need to set up some formatters by filetype formatters_by_ft = formatters_by_ft }) end) diff --git a/lua/pack/configs/indentblankline.lua b/lua/pack/configs/indentblankline.lua index 6459fb2..2d4e3c2 100644 --- a/lua/pack/configs/indentblankline.lua +++ b/lua/pack/configs/indentblankline.lua @@ -2,7 +2,6 @@ local P = { name = "indent-blankline.nvim", -- 仓库名 - module = "ibl", -- require模块名 } -- 懒加载触发器 @@ -11,7 +10,7 @@ vim.api.nvim_create_autocmd({ }, { callback = function() vim.schedule(function() - PackUtils.load(P, function(plugin) + PackUtils.load(P, function() local highlight = { "RainbowBlue", "RainbowViolet", @@ -33,7 +32,7 @@ vim.api.nvim_create_autocmd({ vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) end) - plugin.setup({ + require("ibl").setup({ indent = { highlight = highlight } }) end) diff --git a/lua/pack/configs/lspconfig.lua b/lua/pack/configs/lspconfig.lua index c8f3dfd..9d60b77 100644 --- a/lua/pack/configs/lspconfig.lua +++ b/lua/pack/configs/lspconfig.lua @@ -13,7 +13,6 @@ end -- 2. 插件配置清单 local P = { name = "nvim-lspconfig", - module = "lspconfig", deps = { "mason.nvim", "mason-lspconfig.nvim", "inlay-hints.nvim" }, } diff --git a/lua/pack/configs/mini.lua b/lua/pack/configs/mini.lua new file mode 100644 index 0000000..59eb031 --- /dev/null +++ b/lua/pack/configs/mini.lua @@ -0,0 +1,38 @@ +-- === mini === +local P = { + name = "mini.nvim", -- 仓库名 +} + +-- 懒加载触发器 +vim.api.nvim_create_autocmd({ + "UIEnter", -- vim.schedule(function() +}, { + callback = function() + vim.schedule(function() + PackUtils.load(P, function() + require('mini.surround').setup { + mappings = { + add = 's', -- Add surrounding + delete = 'sd', -- Delete surrounding + find = 'sf', -- Find surrounding (to the right) + find_left = 'sF', -- Find surrounding (to the left) + highlight = 'sh', -- Highlight surrounding + replace = 'cs', -- Replace surrounding/change sround + update_n_lines = 'sn', -- Update `n_lines` + }, + } + end) + end) + end +}) + +-- 懒加载触发器 +-- vim.api.nvim_create_autocmd({ +-- "InsertEnter", "CmdlineEnter", -- 补全/命令行 +-- }, { +-- callback = function() +-- PackUtils.load(P, function() +-- require('mini.pairs').setup {} +-- end) +-- end +-- }) diff --git a/lua/pack/configs/noice.lua b/lua/pack/configs/noice.lua index ccce4f5..295babb 100644 --- a/lua/pack/configs/noice.lua +++ b/lua/pack/configs/noice.lua @@ -3,47 +3,39 @@ if vim.g.vscode then return end local P = { name = "noice.nvim", - module = "noice", deps = { "nui.nvim" }, } --- 复刻 "VeryLazy" 策略 -vim.api.nvim_create_autocmd("UIEnter", { - callback = function() - -- vim.schedule 的作用是:别卡住界面的渲染,等 UI 画完了、闲下来了,再偷偷加载 - vim.schedule(function() - PackUtils.load(P, function(plugin) - plugin.setup({ - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - -- 需要过滤的信息 - routes = { - { - -- 过滤翻译插件的成功提示 - filter = { - event = "msg_show", - find = "Translate success", - }, - -- opts.skip = true 会告诉 Noice 完全忽略这条消息 - opts = { skip = true }, - }, - { - -- 过滤打开rust文件不影响使用的错误提示 - filter = { - event = "msg_show", - kind = "emsg", - find = "Error in decoration provider", - }, - opts = { skip = true }, - }, - }, - }) - end) - end) - end -}) +-- 比其他插件更早启动才能捕获错误、警告等信息,这里不配置懒加载 +PackUtils.load(P, function() + require("noice").setup({ + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + -- 需要过滤的信息 + routes = { + { + -- 过滤翻译插件的成功提示 + filter = { + event = "msg_show", + find = "Translate success", + }, + -- opts.skip = true 会告诉 Noice 完全忽略这条消息 + opts = { skip = true }, + }, + { + -- 过滤打开rust文件不影响使用的错误提示 + filter = { + event = "msg_show", + kind = "emsg", + find = "Error in decoration provider", + }, + opts = { skip = true }, + }, + }, + }) +end) diff --git a/lua/pack/configs/peek.lua b/lua/pack/configs/peek.lua index 482357d..14b2120 100644 --- a/lua/pack/configs/peek.lua +++ b/lua/pack/configs/peek.lua @@ -1,36 +1,34 @@ if vim.g.vscode then return end local P = { - name = "peek.nvim", - module = "peek", - deps = {}, - -- 编译命令:需要环境中安装了 deno - build_cmd = { "deno", "task", "--quiet", "build:fast" }, + name = "peek.nvim", + -- 编译命令:需要环境中安装了 deno + build_cmd = { "deno", "task", "--quiet", "build:fast" }, } PackUtils.setup_listener(P.name, P.build_cmd) -- 2. 封装加载逻辑 local function load_peek() - PackUtils.load(P, function(plugin) - plugin.setup({ - port = 9000, - app = { "zen", "-private-window" }, - -- app = { "firefox-esr", "-private-window" }, - -- app = { "google-chrome-stable", "--app=http://localhost:9000/?theme=dark", "--incognito" }, - }) - end) + PackUtils.load(P, function() + require("peek").setup({ + port = 9000, + app = { "zen", "-private-window" }, + -- app = { "firefox-esr", "-private-window" }, + -- app = { "google-chrome-stable", "--app=http://localhost:9000/?theme=dark", "--incognito" }, + }) + end) end -- 在插件未加载时,这些命令就存在了。一旦被调用,它们会先加载插件,再执行真正的功能。 vim.api.nvim_create_user_command("PeekOpen", function() - load_peek() -- 触发 PackUtils.load (包含构建检查) - require("peek").open() + load_peek() -- 触发 PackUtils.load (包含构建检查) + require("peek").open() end, { desc = "Lazy load and open Peek" }) vim.api.nvim_create_user_command("PeekClose", function() - -- 如果插件没加载,Close 命令通常不需要做任何事,或者也触发加载 - if PackUtils.is_initialized[P.name] then - require("peek").close() - end + -- 如果插件没加载,Close 命令通常不需要做任何事,或者也触发加载 + if PackUtils.is_initialized[P.name] then + require("peek").close() + end end, { desc = "Close Peek" }) diff --git a/lua/pack/configs/snacks.lua b/lua/pack/configs/snacks.lua index c1e7ad4..abda0de 100644 --- a/lua/pack/configs/snacks.lua +++ b/lua/pack/configs/snacks.lua @@ -3,11 +3,10 @@ if vim.g.vscode then return end local P = { name = "snacks.nvim", - module = "snacks", } -PackUtils.load(P, function(plugin) - plugin.setup({ +PackUtils.load(P, function() + require("snacks").setup({ image = {}, lazygit = {}, notifier = {}, -- 替代了folke/noice.nvim插件的rcarriga/nvim-notify依赖 diff --git a/lua/pack/configs/treesitter.lua b/lua/pack/configs/treesitter.lua index e728d3f..276316b 100644 --- a/lua/pack/configs/treesitter.lua +++ b/lua/pack/configs/treesitter.lua @@ -2,7 +2,6 @@ if vim.g.vscode then return end local P = { name = "nvim-treesitter", - module = "nvim-treesitter", build_cmd = ":TSUpdate", } diff --git a/lua/pack/configs/tv.lua b/lua/pack/configs/tv.lua index 8a25a4b..f27e52b 100644 --- a/lua/pack/configs/tv.lua +++ b/lua/pack/configs/tv.lua @@ -3,13 +3,12 @@ if vim.g.vscode then return end local P = { name = "tv.nvim", -- 仓库名 - module = "tv", -- require模块名 } local function load_plugin() - PackUtils.load(P, function(plugin) - local h = plugin.handlers - plugin.setup({ + PackUtils.load(P, function() + local h = require("tv").handlers + require("tv").setup({ channels = { ["git-files"] = { handlers = { diff --git a/lua/pack/configs/ufo.lua b/lua/pack/configs/ufo.lua index e2bc046..63142d2 100644 --- a/lua/pack/configs/ufo.lua +++ b/lua/pack/configs/ufo.lua @@ -9,7 +9,6 @@ vim.o.foldenable = true local P = { name = "nvim-ufo", -- 仓库名 - module = "ufo", -- require模块名 deps = { "promise-async" }, } @@ -19,7 +18,7 @@ vim.api.nvim_create_autocmd({ }, { callback = function() vim.schedule(function() - PackUtils.load(P, function(plugin) + PackUtils.load(P, function() -- Option 2: nvim lsp as LSP client local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.foldingRange = { @@ -32,9 +31,9 @@ vim.api.nvim_create_autocmd({ capabilities = capabilities, }) end - plugin.setup({}) + require("ufo").setup({}) -- Option 3: treesitter as a main provider instead - -- plugin.setup({ + -- require("ufo").setup({ -- provider_selector = function() -- return { "treesitter", "indent" } -- end diff --git a/lua/pack/configs/yazi.lua b/lua/pack/configs/yazi.lua index f466659..b6d1989 100644 --- a/lua/pack/configs/yazi.lua +++ b/lua/pack/configs/yazi.lua @@ -11,15 +11,14 @@ vim.g.loaded_netrwPlugin = 1 local P = { name = "yazi.nvim", - module = "yazi", deps = { "plenary.nvim" }, } -- 快捷键触发懒加载 vim.keymap.set({ "n", "v" }, "tt", function() -- 核心:直接调用引擎,把配置逻辑传进去 - PackUtils.load(P, function(plugin) - plugin.setup({ + PackUtils.load(P, function() + require("yazi").setup({ open_for_directories = false, keymaps = { show_help = "" }, }) diff --git a/lua/pack/plugins.lua b/lua/pack/plugins.lua index 435b660..ecac2d6 100644 --- a/lua/pack/plugins.lua +++ b/lua/pack/plugins.lua @@ -28,6 +28,10 @@ local specs = { "https://github.com/MunifTanjim/nui.nvim", -- snacks.lua 图片预览、lazygit、lsp_references模糊查找 "https://github.com/folke/snacks.nvim", + -- mini.lua 各种对字符的surround包裹{} [] '' + "https://github.com/echasnovski/mini.nvim", + -- autopairs.lua 对字符自动补全另一半 + "https://github.com/windwp/nvim-autopairs", -- tv.lua 模糊查找television "https://github.com/alexpasmantier/tv.nvim", -- coderunner.lua 运行代码 @@ -263,45 +267,37 @@ end -- 全方位防崩加载引擎 function PackUtils.load(P, config_fn) + -- 自动纠错插件名和依赖名 P.name = PackUtils.get_name(P.name) if P.deps then for i, dep in ipairs(P.deps) do P.deps[i] = PackUtils.get_name(dep) end end + if PackUtils.disabled_plugins[P.name] then return end if PackUtils.is_initialized[P.name] then return end + + -- 检查插件是否存在于磁盘,如果找不到,说明它正在后台被 vim.pack 异步克隆下载,直接静默退出 + if not PackUtils.get_root(P.name) then return end + + -- 走到这里,说明插件绝对在硬盘上了,执行常规准备工作 PackUtils.check_health(P.name, P.build_cmd) - - -- 强制将主插件挂载到 runtimepath pcall(vim.cmd.packadd, P.name) - - -- 保护依赖加载 (防止 dependencies 里的插件没下载) if P.deps then for _, dep in ipairs(P.deps) do local dep_ok = pcall(vim.cmd.packadd, dep) if not dep_ok then - vim.notify("Warning: " .. P.name .. " dependency [" .. dep .. "] missing", vim.log.levels.WARN) + vim.notify("Warning: " .. P.name .. " dependency[" .. dep .. "] missing", vim.log.levels.WARN) end end end - -- 保护 require (防止插件文件夹还没下载完) - local req_ok, plugin = pcall(require, P.module) - -- 如果失败,说明插件还没下载好或者路径不对,优雅退出 - if not req_ok then - -- 经过上面强制挂载后还是失败,且硬盘上确实有这个文件夹,那绝对是 module 填错了 - if PackUtils.get_root(P.name) then - vim.notify("Error: Plugin [" .. P.name .. "] module not found", vim.log.levels.ERROR) - end - return - end - - -- 保护 Setup 执行:使用 pcall 包裹传进来的匿名函数,防止 setup 里的参数写错导致崩溃 + -- 保护 Setup 执行:自由地 require,如有拼写错误,这里的 pcall 会完美捕获并报错 if config_fn then - local setup_ok, err = pcall(config_fn, plugin) + local setup_ok, err = pcall(config_fn) if not setup_ok then - vim.notify("Error: " .. P.name .. " setup failed: " .. tostring(err), vim.log.levels.ERROR) + vim.notify("Error: " .. P.name .. " setup failed: \n" .. tostring(err), vim.log.levels.ERROR) return end end diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 85792c0..7df907c 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -40,6 +40,10 @@ "rev": "b03fb0f20bc1d43daf558cda981a2be22e73ac42", "src": "https://github.com/williamboman/mason.nvim" }, + "mini.nvim": { + "rev": "c67822c53e8e282fe863343e88aa0a8ca3534059", + "src": "https://github.com/echasnovski/mini.nvim" + }, "noice.nvim": { "rev": "7bfd942445fb63089b59f97ca487d605e715f155", "src": "https://github.com/folke/noice.nvim" @@ -48,6 +52,10 @@ "rev": "de740991c12411b663994b2860f1a4fd0937c130", "src": "https://github.com/MunifTanjim/nui.nvim" }, + "nvim-autopairs": { + "rev": "59bce2eef357189c3305e25bc6dd2d138c1683f5", + "src": "https://github.com/windwp/nvim-autopairs" + }, "nvim-lspconfig": { "rev": "bedca8b426b2fee0ccac596d167d71bbe971253f", "src": "https://github.com/neovim/nvim-lspconfig" diff --git a/snippets/lua.json b/snippets/lua.json index f4f34ca..49028f1 100644 --- a/snippets/lua.json +++ b/snippets/lua.json @@ -22,18 +22,17 @@ "if vim.g.vscode then return end", "", "local P = {", - "\tname = \"${2:<++>}\", -- 仓库名", - "\tmodule = \"${3:<++>}\", -- require模块名", - "\tdeps = { ${4} },", - "\tbuild_cmd = ${5:nil},", + "\tname = \"${2:<++>}\",", + "\tdeps = { ${3} },", + "\tbuild_cmd = ${4:nil},", "}", "", - "${6}-- 注册构建监听器", + "${5}-- 注册构建监听器", "PackUtils.setup_listener(P.name, P.build_cmd)", "", "-- 懒加载触发器", "vim.api.nvim_create_autocmd({", - "\t${7}-- \"InsertEnter\", \"CmdlineEnter\", -- 补全/命令行", + "\t${6}-- \"InsertEnter\", \"CmdlineEnter\", -- 补全/命令行", "\t-- \"BufReadPost\", \"BufNewFile\", -- 界面/语法类", "\t-- \"LspAttach\", -- LSP 相关", "\t-- \"FileType\", -- 确定文件类型", @@ -41,20 +40,16 @@ "\t-- \"UIEnter\", -- vim.schedule(function()", "}, {", "\tcallback = function()", - "\t\tPackUtils.load(P, function(plugin)", - "\t\t\tplugin.setup({", - "\t\t\t\t$8", - "\t\t\t})", + "\t\tPackUtils.load(P, function()", + "\t\t\t$7", "\t\tend)", "\tend", "})", - "-- vim.keymap.set({ \"n\", \"v\" }, \"${9:<++>}\", function()", - "-- \tPackUtils.load(P, function(plugin)", - "-- \t\tplugin.setup({", - "-- \t\t\t$10", - "-- \t\t})", + "-- vim.keymap.set({ \"n\", \"v\" }, \"${8:<++>}\", function()", + "-- \tPackUtils.load(P, function()", + "-- \t\t$9", "-- \tend)", - "-- \tvim.cmd(\"${11:Command}\")", + "-- \tvim.cmd(\"${10:Command}\")", "-- end, { desc = \"${0:描述}\" })" ], "description": "Neovim Native Package Loader (Pure Config)"