mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-14 23:16:47 +00:00
35 lines
840 B
Lua
35 lines
840 B
Lua
-- cmp.lua - 自动补全配置
|
|
return {
|
|
{
|
|
"hrsh7th/nvim-cmp",
|
|
dependencies = {
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
"hrsh7th/cmp-buffer",
|
|
"hrsh7th/cmp-path",
|
|
"L3MON4D3/LuaSnip",
|
|
"saadparwaiz1/cmp_luasnip",
|
|
},
|
|
event = "InsertEnter",
|
|
opts = function()
|
|
local cmp = require("cmp")
|
|
return {
|
|
snippet = {
|
|
expand = function(args)
|
|
require("luasnip").lsp_expand(args.body)
|
|
end,
|
|
},
|
|
mapping = cmp.mapping.preset.insert({
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
|
}),
|
|
sources = cmp.config.sources({
|
|
{ name = "nvim_lsp" },
|
|
{ name = "luasnip" },
|
|
{ name = "buffer" },
|
|
{ name = "path" },
|
|
}),
|
|
}
|
|
end,
|
|
},
|
|
}
|