diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index ddba684..6bb7800 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua @@ -1,44 +1,47 @@ return { - "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", - { "zbirenbaum/copilot-cmp", opts = {} }, - }, - event = "InsertEnter", - config = function() - local cmp = require("cmp") + "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", + { "zbirenbaum/copilot-cmp", opts = {} }, + }, + event = "InsertEnter", + config = function() + local cmp = require("cmp") - cmp.setup({ - formatting = { - format = require("lspkind").cmp_format(), - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.scroll_docs(-2), - [""] = cmp.mapping.scroll_docs(2), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "buffer" }, - { name = "copilot" }, - { name = "emoji" }, - }), - }) - end, + cmp.setup({ + formatting = { + format = require("lspkind").cmp_format(), + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-2), + [""] = cmp.mapping.scroll_docs(2), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + + + sources = cmp.config.sources({ + { name = "nvim_lsp", priority = 3 }, + { name = "nvim_lsp_signature_help", priority = 10 }, + { name = "buffer", keyword_length = 3 }, + { name = "copilot" }, + { name = "emoji" }, + }), + }) + end, }