Files
dotfiles/nvim/lua/plugins/completion.lua
2026-06-18 11:36:12 +08:00

57 lines
1.9 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================================================
-- 智能补全 (blink.cmp)
-- ============================================================================
return {
{
"saghen/blink.cmp",
version = "*",
event = { "InsertEnter", "CmdlineEnter" },
opts = {
keymap = {
preset = "super-tab",
["<C-j>"] = { "select_next" },
["<C-k>"] = { "select_prev" },
["<C-u>"] = { "scroll_documentation_up" },
["<C-n>"] = { "scroll_documentation_down" },
-- 命令行模式Enter 确认补全而非执行命令
["<CR>"] = { "accept", "fallback" },
},
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "normal",
},
sources = {
default = { "lsp", "path", "buffer", "snippets" },
},
cmdline = {
enabled = true,
sources = function()
if vim.fn.getcmdline():find("/") then
return { "buffer" }
end
return { "cmdline" }
end,
completion = { menu = { auto_show = true } },
},
completion = {
menu = {
border = "rounded",
-- scrollbar = false,
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "source_name" },
},
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 500,
window = { border = "rounded" },
},
},
},
},
}