From 095d157420576bf58341da0d257282b4b9882b38 Mon Sep 17 00:00:00 2001 From: serxoz Date: Wed, 28 Feb 2024 12:13:52 +0100 Subject: [PATCH] copilot como fonte do lsp --- nvim/after/plugin/copilot.lua | 4 ++++ nvim/after/plugin/lsp.lua | 30 +++++++++++++++++++++++++++++- nvim/lua/serxoz/packer.lua | 9 ++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 nvim/after/plugin/copilot.lua diff --git a/nvim/after/plugin/copilot.lua b/nvim/after/plugin/copilot.lua new file mode 100644 index 0000000..679f73b --- /dev/null +++ b/nvim/after/plugin/copilot.lua @@ -0,0 +1,4 @@ +require('copilot').setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, +}) diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua index eab841a..e061d63 100644 --- a/nvim/after/plugin/lsp.lua +++ b/nvim/after/plugin/lsp.lua @@ -35,8 +35,36 @@ local cmp_mappings = lsp.defaults.cmp_mappings({ cmp_mappings[''] = nil cmp_mappings[''] = nil +-- cmp.setup({ +-- mapping = cmp_mappings, +-- sources = { +-- -- Copilot sources +-- { name = 'copilot' }, +-- -- Other sources +-- { name = 'nvim_lsp' }, +-- { name = 'buffer' }, +-- { name = 'path' }, +-- { name = 'calc' }, +-- { name = 'emoji' }, +-- { name = 'treesitter' }, +-- { name = 'vsnip' }, +-- } +-- }) + lsp.setup_nvim_cmp({ - mapping = cmp_mappings + mapping = cmp_mappings, + sources = { + -- Copilot sources + { name = 'copilot' }, + -- Other sources + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'calc' }, + { name = 'emoji' }, + { name = 'treesitter' }, + { name = 'vsnip' }, + } }) lsp.set_preferences({ diff --git a/nvim/lua/serxoz/packer.lua b/nvim/lua/serxoz/packer.lua index daa3d98..9dc4877 100644 --- a/nvim/lua/serxoz/packer.lua +++ b/nvim/lua/serxoz/packer.lua @@ -60,7 +60,14 @@ return require('packer').startup(function(use) } use("folke/zen-mode.nvim") - use("github/copilot.vim") + use("zbirenbaum/copilot.lua") + use { + "zbirenbaum/copilot-cmp", + after = { "copilot.lua" }, + config = function () + require("copilot_cmp").setup() + end + } use("CopilotC-Nvim/CopilotChat.nvim") use("eandrju/cellular-automaton.nvim") -- use("laytan/cloak.nvim")