From 80cc397da46569a66a6fac6ec857542e05d531a2 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 20 Apr 2024 16:00:09 -0700 Subject: [PATCH] disable copilot in markdown --- lazy-lock.json | 6 +++--- lua/plugins/copilot.lua | 30 ++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 09db190..8d4db2b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -16,7 +16,7 @@ "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, - "gitsigns.nvim": { "branch": "main", "commit": "7e38f07cab0e5387f9f41e92474db174a63a4725" }, + "gitsigns.nvim": { "branch": "main", "commit": "035da036e68e509ed158414416c827d022d914bd" }, "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, "lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" }, @@ -41,7 +41,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "ed8b8a15acc441aec669f97d75f2c1f2ac8c8aa5" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, "nvim-spectre": { "branch": "master", "commit": "9653847cf2f225648967f6e9363643e327387579" }, - "nvim-treesitter": { "branch": "master", "commit": "d8bf42b2621f5af274ccd4ac3f742caea04723b4" }, + "nvim-treesitter": { "branch": "master", "commit": "ea4f6d5175812a3f48302d638a766bc18fcbb04a" }, "nvim-treesitter-context": { "branch": "master", "commit": "ba4289ad345ececd335a9cdd7b9616fd0bb6be92" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, @@ -63,7 +63,7 @@ "vim-illuminate": { "branch": "master", "commit": "e522e0dd742a83506db0a72e1ced68c9c130f185" }, "vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" }, "vim-wakatime": { "branch": "master", "commit": "5d11a253dd1ecabd4612a885175216032d814300" }, - "vimtex": { "branch": "master", "commit": "4a0ea3fc7eb67fd1949aba6a9bbd91cb5c875743" }, + "vimtex": { "branch": "master", "commit": "268dd8d311adebb121fa0a4b31cdabcb98072403" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "yanky.nvim": { "branch": "main", "commit": "7c5cbf0122ff2dfbb6a92f14885894f65949cc8b" } } \ No newline at end of file diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua index f56e404..6ed6640 100644 --- a/lua/plugins/copilot.lua +++ b/lua/plugins/copilot.lua @@ -1,8 +1,34 @@ return { { "zbirenbaum/copilot.lua", - opts = function(_, opts) - table.insert(opts.filetypes, { markdown = false }) + cmd = "Copilot", + build = ":Copilot auth", + opts = { + suggestion = { enabled = false }, + panel = { enabled = false }, + filetypes = { + markdown = false, + help = true, + }, + }, + }, + { + "zbirenbaum/copilot-cmp", + dependencies = "copilot.lua", + opts = { + event = { "InsertEnter", "LspAttach" }, + fix_pairs = true, + }, + config = function(_, opts) + local copilot_cmp = require("copilot_cmp") + copilot_cmp.setup(opts) + -- attach cmp source whenever copilot attaches + -- fixes lazy-loading issues with the copilot cmp source + LazyVim.lsp.on_attach(function(client) + if client.name == "copilot" then + copilot_cmp._on_insert_enter({}) + end + end) end, }, }