chore(nvim): optimize lazy loading

This commit is contained in:
js0ny 2025-03-05 01:31:11 +00:00
parent 6f3665bf47
commit f12260deb2
8 changed files with 79 additions and 13 deletions

View file

@ -8,7 +8,8 @@ end
return {
"hrsh7th/nvim-cmp",
lazy = false,
-- lazy = false,
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
@ -58,15 +59,32 @@ return {
})
-- 配置 cmdline 模式
cmp.setup.cmdline(":", {
-- cmp.setup.cmdline(":", {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = {
-- { name = "cmdline" },
-- },
-- })
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "cmdline" },
-- path completion is slow under WSL
-- Since WSL loads Windows Environment Variables
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
-- 配置 LSP
for _, server in ipairs(servers) do
local config = vim.tbl_deep_extend("force", default_server_config, servers_config[server] or {})