From 5cf86f505a768bcaad581b9c7e2a62f563e22f99 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 19 Jan 2024 21:23:43 +0100 Subject: [PATCH] feat: Copilot for NvChad --- nvchad/.config/nvim/lua/custom/mappings.lua | 10 ++++++++++ nvchad/.config/nvim/lua/custom/plugins.lua | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/nvchad/.config/nvim/lua/custom/mappings.lua b/nvchad/.config/nvim/lua/custom/mappings.lua index e23127b..d7ac9a8 100644 --- a/nvchad/.config/nvim/lua/custom/mappings.lua +++ b/nvchad/.config/nvim/lua/custom/mappings.lua @@ -22,6 +22,16 @@ M.general = { ["J"] = { ":m '>+1gv=gv" }, ["K"] = { ":m '<-2gv=gv" }, }, + + i = { + [""] = { + function() + vim.fn.feedkeys(vim.fn["copilot#Accept"](), "") + end, + "Copilot Accept", + { replace_keycodes = true, nowait = true, silent = true, expr = true, noremap = true }, + }, + }, } -- more keybinds! diff --git a/nvchad/.config/nvim/lua/custom/plugins.lua b/nvchad/.config/nvim/lua/custom/plugins.lua index 9d09d71..c4eda81 100644 --- a/nvchad/.config/nvim/lua/custom/plugins.lua +++ b/nvchad/.config/nvim/lua/custom/plugins.lua @@ -47,6 +47,19 @@ local plugins = { end, }, + { + "github/copilot.vim", + lazy = false, + config = function() + -- Mapping tab is already used by NvChad + vim.g.copilot_no_tab_map = true; + vim.g.copilot_assume_mapped = true; + vim.g.copilot_tab_fallback = ""; + -- The mapping is set to other key, see custom/lua/mappings + -- or run ch to see copilot mapping section + end + }, + -- To make a plugin not be loaded -- { -- "NvChad/nvim-colorizer.lua",