diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua deleted file mode 100644 index 3b60898..0000000 --- a/lua/plugins/copilot.lua +++ /dev/null @@ -1,57 +0,0 @@ --- Copilot. -return { - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - event = "InsertEnter", - opts = { - -- I don't find the panel useful. - panel = { enabled = false }, - suggestion = { - auto_trigger = true, - -- Use alt to interact with Copilot. - keymap = { - -- Disable the built-in mapping, we'll configure it in nvim-cmp. - accept = false, - accept_word = "", - accept_line = "", - next = "", - prev = "", - dismiss = "/", - }, - }, - filetypes = { markdown = true, lua = true, python = true, typescript = true, javascript = true }, - }, - config = function(_, opts) - local cmp = require("cmp") - local copilot = require("copilot.suggestion") - local luasnip = require("luasnip") - - require("copilot").setup(opts) - - local function set_trigger(trigger) - vim.b.copilot_suggestion_auto_trigger = trigger - vim.b.copilot_suggestion_hidden = not trigger - end - - -- Hide suggestions when the completion menu is open. - cmp.event:on("menu_opened", function() - if copilot.is_visible() then - copilot.dismiss() - end - set_trigger(false) - end) - - -- Disable suggestions when inside a snippet. - cmp.event:on("menu_closed", function() - set_trigger(not luasnip.expand_or_locally_jumpable()) - end) - vim.api.nvim_create_autocmd("User", { - pattern = { "LuasnipInsertNodeEnter", "LuasnipInsertNodeLeave" }, - callback = function() - set_trigger(not luasnip.expand_or_locally_jumpable()) - end, - }) - end, - }, -} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index c20d8a3..c5d9c20 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -73,10 +73,7 @@ return { [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Replace, select = true }), [""] = cmp.mapping(function(fallback) - local copilot = require("copilot.suggestion") - if copilot.is_visible() then - copilot.accept_line() - elseif cmp.visible() then + if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump()