dotfiles/.config/nvim/lua/plugins/cmp.lua

45 lines
1.1 KiB
Lua
Raw Normal View History

2023-03-08 11:04:13 +01:00
return {
2022-12-28 12:23:25 +01:00
"hrsh7th/nvim-cmp",
dependencies = {
"andersevenrud/cmp-tmux",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"onsails/lspkind-nvim",
2023-03-08 11:04:13 +01:00
{ "zbirenbaum/copilot-cmp", opts = {} },
2022-12-28 12:23:25 +01:00
},
event = "InsertEnter",
2023-03-08 11:04:13 +01:00
config = function()
local cmp = require("cmp")
2022-12-27 18:36:38 +01:00
2023-03-08 11:04:13 +01:00
cmp.setup({
formatting = {
format = require("lspkind").cmp_format(),
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<Up>"] = cmp.mapping.select_prev_item(),
["<Down>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-2),
["<C-u>"] = cmp.mapping.scroll_docs(2),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
2022-12-28 12:23:25 +01:00
}),
2023-03-08 11:04:13 +01:00
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "buffer" },
{ name = "copilot" },
{ name = "emoji" },
2022-12-28 12:23:25 +01:00
}),
2023-03-08 11:04:13 +01:00
})
end,
}