From e5730e176b36f07b20d783f541b8f74349dc2fea Mon Sep 17 00:00:00 2001 From: salomaestro Date: Fri, 11 Oct 2024 23:14:17 +0200 Subject: [PATCH] Configure copilot --- lua/mappings.lua | 3 +++ lua/plugins/init.lua | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 61d34ae..e768b3d 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -2,6 +2,7 @@ require "nvchad.mappings" -- add yours here +local vim = vim local map = vim.keymap.set local g = vim.g local diag = vim.diagnostic @@ -11,6 +12,8 @@ map("i", "jk", "") -- map({ "n", "i", "v" }, "", " w ") +map("n", "cp", " Copilot panel", { desc = "Copilot panel" }) + map("n", "ca", function() vim.lsp.buf.code_action() end, { desc = "LSP code action" }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b977dd1..83491ce 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -76,9 +76,26 @@ return { { import = "nvcommunity.completion.copilot" }, { "copilot.lua", - -- opts = { - -- ... - -- }, + cmd = "Copilot", + event = "InsertEnter", + config = function() + require("copilot").setup({ + suggestion = { + enabled = true, + auto_trigger = false, + hide_during_completion = true, + debounce = 75, + keymap = { + accept = "", + accept_word = false, + accept_line = false, + next = "", + prev = "", + dismiss = "", + }, + }, + }) + end, }, },