From d7a9f451cc610ad1805466858c14fb6f7fde24cc Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Fri, 13 Dec 2024 17:15:01 -0500 Subject: [PATCH] AutoYADM commit: 2024-12-13 17:15:01 --- .config/nvim/lazyvim.json | 2 - .config/nvim/lua/plugins/copilot.lua | 80 ++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lazyvim.json b/.config/nvim/lazyvim.json index 1bc97ed7..51322ba6 100644 --- a/.config/nvim/lazyvim.json +++ b/.config/nvim/lazyvim.json @@ -1,7 +1,5 @@ { "extras": [ - "lazyvim.plugins.extras.ai.copilot", - "lazyvim.plugins.extras.ai.copilot-chat", "lazyvim.plugins.extras.coding.mini-comment", "lazyvim.plugins.extras.coding.mini-surround", "lazyvim.plugins.extras.coding.yanky", diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua index 76d11e2a..a92fd299 100644 --- a/.config/nvim/lua/plugins/copilot.lua +++ b/.config/nvim/lua/plugins/copilot.lua @@ -1,3 +1,11 @@ +local chat_opts = { + auto_insert_mode = false, + question_header = " Fic", + answer_header = " Copilot ", + window = { + width = 0.4, + }, +} return { { "zbirenbaum/copilot-cmp", @@ -23,7 +31,73 @@ return { -- Snacks.toggle.map(cptoggle, "at", { desc = "Toggle Copilot" }) end, }, - { "CopilotC-Nvim/CopilotChat.nvim", opts = { - auto_insert_mode = false, - } }, + { + "CopilotC-Nvim/CopilotChat.nvim", + branch = "main", + cmd = "CopilotChat", + keys = { + { "", "", ft = "copilot-chat", desc = "Submit Prompt", remap = true }, + { "a", "", desc = "+ai", mode = { "n", "v" } }, + { + "aa", + function() + return require("CopilotChat").toggle() + end, + desc = "Toggle (CopilotChat)", + mode = { "n", "v" }, + }, + { + "ax", + function() + return require("CopilotChat").reset() + end, + desc = "Clear (CopilotChat)", + mode = { "n", "v" }, + }, + { + "aq", + function() + local input = vim.fn.input("Quick Chat: ") + if input ~= "" then + require("CopilotChat").ask(input) + end + end, + desc = "Quick Chat (CopilotChat)", + mode = { "n", "v" }, + }, + -- Show prompts actions with telescope + -- { "ap", M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, + config = function() + local chat = require("CopilotChat") + + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "copilot-chat", + callback = function() + vim.opt_local.relativenumber = false + vim.opt_local.number = false + vim.opt_local.spell = false + end, + }) + + chat.setup(chat_opts) + end, + }, + }, + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + build = ":Copilot auth", + -- event = "Buf", + lazy = true, + opts = { + suggestion = { + enabled = false, + }, + panel = { enabled = false }, + filetypes = { + markdown = true, + help = true, + }, + }, + }, }