From 4ebaaec2b7635e32f78562dc2dbfdd0c66902b17 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sat, 21 Feb 2026 13:58:27 +0100 Subject: neovim: Keymaps und bessere Konfiguration für Copilot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/lua/config/keymaps.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'nvim/lua/config/keymaps.lua') diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 72030c4..123e039 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -73,8 +73,33 @@ function M.gitsigns() end function M.copilot() - map("n", "ce", ":Copilot enable") - map("n", "cd", ":Copilot disable") + if vim.fn.exists(":Copilot") == 0 then return end + + map("n", "ct", function() + local status = vim.fn["copilot#Enabled"]() + + if status == 1 then + vim.cmd("Copilot disable") + print("Copilot disabled") + else + vim.cmd("Copilot enable") + print("Copilot enabled") + end + end, { desc = "Copilot Toggle" }) + + map("n", "ce", function() + vim.cmd("Copilot enable") + print("Copilot enabled") + end, { desc = "Copilot Enable" }) + + map("n", "cd", function() + vim.cmd("Copilot disable") + print("Copilot disabled") + end, { desc = "Copilot Disable" }) + + map("n", "cs", function() + vim.cmd("Copilot status") + end, { desc = "Copilot Status" }) end function M.global() -- cgit v1.3