From 2100ba5aa667572b3f28b1703f55c55a36cbc031 Mon Sep 17 00:00:00 2001 From: Ahmed Elsakaan Date: Mon, 5 Dec 2022 04:24:24 +0000 Subject: [PATCH] feat: adds cmp copilot support --- init.lua | 1 + lua/config/cmp.lua | 4 ++++ lua/config/copilot.lua | 6 ++++++ lua/config/plugins.lua | 8 +++++--- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 lua/config/copilot.lua diff --git a/init.lua b/init.lua index c996186..10cafb0 100644 --- a/init.lua +++ b/init.lua @@ -8,6 +8,7 @@ require("config.colorschemes") require("config.better-escape") require("config.treesitter") require("config.autopairs") +require("config.copilot") require("config.cmp") require("config.lsp") require("config.neo-tree") diff --git a/lua/config/cmp.lua b/lua/config/cmp.lua index ea9940f..706b32f 100644 --- a/lua/config/cmp.lua +++ b/lua/config/cmp.lua @@ -57,6 +57,9 @@ import({ "cmp", "luasnip", "lspkind", "luasnip/loaders/from_vscode" }, function( fields = { "abbr", "kind", "menu" }, format = modules.lspkind.cmp_format({ mode = "symbol_text", + symbol_map = { + Copilot = "", + }, before = function(entry, vim_item) vim_item.menu = ({ nvim_lsp = "[LSP]", @@ -70,6 +73,7 @@ import({ "cmp", "luasnip", "lspkind", "luasnip/loaders/from_vscode" }, function( }, sources = { { name = "nvim_lsp" }, + { name = "copilot" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, diff --git a/lua/config/copilot.lua b/lua/config/copilot.lua new file mode 100644 index 0000000..836b574 --- /dev/null +++ b/lua/config/copilot.lua @@ -0,0 +1,6 @@ +import({ "copilot", "copilot_cmp" }, function(modules) + local copilot_cmp = modules["copilot_cmp"] + + modules.copilot.setup() + copilot_cmp.setup() +end) diff --git a/lua/config/plugins.lua b/lua/config/plugins.lua index 51b422a..d5ac8be 100644 --- a/lua/config/plugins.lua +++ b/lua/config/plugins.lua @@ -60,7 +60,7 @@ return packer.startup(function(use) use("yamatsum/nvim-cursorline") use("brenoprata10/nvim-highlight-colors") use("ThePrimeagen/harpoon") - use("akinsho/git-conflict.nvim") + use("akinsho/git-conflict.nvim") -- Colorscheme use({ "catppuccin/nvim", as = "catppuccin" }) @@ -90,6 +90,8 @@ return packer.startup(function(use) use("L3MON4D3/LuaSnip") use("rafamadriz/friendly-snippets") use("onsails/lspkind.nvim") + use("zbirenbaum/copilot.lua") + use("zbirenbaum/copilot-cmp") -- LSP use("williamboman/mason.nvim") @@ -112,7 +114,7 @@ return packer.startup(function(use) use("folke/trouble.nvim") use("smiteshp/nvim-navic") use("utilyre/barbecue.nvim") - use("simrat39/rust-tools.nvim") + use("simrat39/rust-tools.nvim") -- Editing use("max397574/better-escape.nvim") @@ -132,7 +134,7 @@ return packer.startup(function(use) use("akinsho/toggleterm.nvim") use("rcarriga/nvim-notify") use("ThePrimeagen/vim-be-good") - use("aserowy/tmux.nvim") + use("aserowy/tmux.nvim") if PACKER_BOOTSTRAP then require("packer").sync()