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 +++++++++++++++++++++++++++-- nvim/lua/plugins/copilot.lua | 7 +++++-- 2 files changed, 32 insertions(+), 4 deletions(-) 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() diff --git a/nvim/lua/plugins/copilot.lua b/nvim/lua/plugins/copilot.lua index 392e831..8f0bd52 100644 --- a/nvim/lua/plugins/copilot.lua +++ b/nvim/lua/plugins/copilot.lua @@ -3,7 +3,9 @@ return { -- enabled = false, event = "InsertEnter", - config = function() + init = function() + -- vim.g.copilot_no_tab_map = true + vim.g.copilot_filetypes = { ["*"] = false, -- Standardmäßig aus, ... @@ -21,7 +23,8 @@ return { css = true, markdown = true, } - + end, + config = function() local keymaps = require("config.keymaps") keymaps.copilot() end, -- cgit v1.3