From 99f0c784c82e8c418ab72014365d6e4285d83847 Mon Sep 17 00:00:00 2001 From: Rikuoh Date: Mon, 30 Dec 2024 22:45:48 +0900 Subject: [PATCH] cody --- init.lua | 76 ++++++-------------------------------------------------- 1 file changed, 8 insertions(+), 68 deletions(-) diff --git a/init.lua b/init.lua index 1f0f2fc..0536d37 100644 --- a/init.lua +++ b/init.lua @@ -233,8 +233,7 @@ require("lazy").setup({ { "nvim-zh/colorful-winsep.nvim", config = true, event = "WinNew" }, { "kevinhwang91/nvim-bqf", ft = "qf" }, { "vim-jp/vimdoc-ja", ft = "help" }, - { "zbirenbaum/copilot.lua", cmd = "Copilot" }, - { "CopilotC-Nvim/CopilotChat.nvim", build = "make tiktoken" }, + { "sourcegraph/sg.nvim", event = "LspAttach" }, --non-lazy { "vim-denops/denops.vim", lazy = false }, @@ -622,6 +621,7 @@ cmp.setup({ mode = "symbol", maxwidth = 50, ellipsis_char = "...", + symbol_map = { Cody = "❄" }, }), }, @@ -629,6 +629,7 @@ cmp.setup({ { name = "nvim_lsp", max_item_count = 15, keyword_length = 2 }, { name = "vsnip", max_item_count = 15, keyword_length = 2 }, { name = "nvim_lsp_signature_help" }, + { name = "cody", keyword_length = 2 }, { name = "buffer", max_item_count = 15, keyword_length = 2 }, }), }) @@ -961,72 +962,11 @@ vim.keymap.set("n", "ga", ":Gin add .", { silent = true }) vim.keymap.set("n", "gc", ":Gin commit -m ") vim.keymap.set("n", "gp", ":Gin push") ---copilot -local select = require("CopilotChat.select") - -require("copilot").setup({ - suggestion = { enabled = false }, - panel = { enabled = false }, - filetypes = { - markdown = false, - text = false, - }, -}) - -require("CopilotChat").setup({ - debug = true, - - window = { - layout = "float", - relative = "editor", - }, - prompts = { - Explain = { - prompt = "/COPILOT_EXPLAIN 選択されたコードの説明を段落をつけて書いてください。", - }, - Review = { - prompt = "/COPILOT_REVIEW 選択されたコードをレビューしてください。", - callback = function(response, source) end, - }, - Fix = { - prompt = "/COPILOT_FIX このコードには問題があります。バグを修正したコードに書き直してください。", - }, - Optimize = { - prompt = "/COPILOT_REFACTOR 選択されたコードを最適化してパフォーマンスと可読性を向上させてください。", - }, - Docs = { - prompt = "/COPILOT_DOCS 選択されたコードに対してドキュメンテーションコメントを追加してください。", - }, - Tests = { - prompt = "/COPILOT_TESTS 選択されたコードの詳細な単体テスト関数を書いてください。", - }, - FixDiagnostic = { - prompt = "ファイル内の次のような診断上の問題を解決してください:", - selection = select.diagnostics, - }, - }, -}) - -function CopilotChatBuffer() - local input = vim.fn.input("Quick Chat: ") - if input ~= "" then - require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer }) - end -end - -vim.api.nvim_set_keymap("n", "9", "lua CopilotChatBuffer()", { noremap = true, silent = true }) - -function ShowCopilotChatActionPrompt() - local actions = require("CopilotChat.actions") - require("CopilotChat.integrations.telescope").pick(actions.prompt_actions()) -end - -vim.api.nvim_set_keymap( - "n", - "0", - "lua ShowCopilotChatActionPrompt()", - { noremap = true, silent = true } -) +--cody +require("sg").setup() +vim.keymap.set("n", "9", ":CodyToggle", { silent = true }) +vim.keymap.set("v", "0", ":CodyTask ") +vim.keymap.set("v", "-", ":CodyAsk ") --COLORSCHEME vim.keymap.set("n", "8", "colorscheme edge", { noremap = true, silent = true })