mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-14 07:26:44 +00:00
34
nvim/lua/plugins/cmp.lua
Normal file
34
nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
-- 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,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user