diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 5de5c8d..f72c46a 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -1,65 +1,82 @@ return { - "hrsh7th/nvim-cmp", - -- load cmp on InsertEnter - event = "InsertEnter", - -- these dependencies will only be loaded when cmp loads - -- dependencies are always lazy-loaded unless specified otherwise - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-vsnip', - 'hrsh7th/vim-vsnip', - 'hrsh7th/vim-vsnip-integ', - 'onsails/lspkind.nvim', - }, - config = function() - local cmp = require('cmp') - local lspkind = require('lspkind') + { + "hrsh7th/nvim-cmp", + -- load cmp on InsertEnter + event = "InsertEnter", + -- these dependencies will only be loaded when cmp loads + -- dependencies are always lazy-loaded unless specified otherwise + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-vsnip', + 'hrsh7th/vim-vsnip', + 'hrsh7th/vim-vsnip-integ', + 'onsails/lspkind.nvim', + }, + config = function() + local cmp = require('cmp') + local lspkind = require('lspkind') - cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - mapping = { - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [''] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end end - end - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - { name = "copilot"}, - },{ + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = "copilot" }, + }, { { name = 'buffer' }, --{ name = 'path' }, }), - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol_text', -- show only symbol annotations - maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - ellipsis_char = '…', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - symbol_map = { Copilot = "" }, - }) - }, - }) - end, + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol_text', -- show only symbol annotations + maxwidth = 80, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + ellipsis_char = '…', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + symbol_map = { Copilot = "" }, + }) + }, + }) + end, + }, + { + 'zbirenbaum/copilot-cmp', + dependencies = { "hrsh7th/nvim-cmp", + { + 'zbirenbaum/copilot.lua', + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + filetypes = { + mail = false, + } + } + } + }, + }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index efd9714..1af8e03 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -35,10 +35,6 @@ return { 'folke/lsp-colors.nvim', 'nvim-lua/popup.nvim', - 'zbirenbaum/copilot.lua', - {'zbirenbaum/copilot-cmp', - dependencies = { "hrsh7th/nvim-cmp" }, - }, 'junegunn/vim-easy-align', 'machakann/vim-highlightedyank', 'vim-airline/vim-airline', diff --git a/plugin/copilot.lua b/plugin/copilot.lua deleted file mode 100644 index c644093..0000000 --- a/plugin/copilot.lua +++ /dev/null @@ -1,8 +0,0 @@ -require("copilot").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - filetypes = { - mail = false, - } -}) -require("copilot_cmp").setup()