This commit is contained in:
Rikuoh Tsujitani 2024-12-30 22:45:48 +09:00
parent f7de5f9a26
commit 99f0c784c8
Signed by: riq0h
GPG key ID: 010F09DEA298C717

View file

@ -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", "<leader>ga", ":<C-u>Gin add .<CR>", { silent = true })
vim.keymap.set("n", "<leader>gc", ":<C-u>Gin commit -m ")
vim.keymap.set("n", "<leader>gp", ":<C-u>Gin push<CR>")
--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", "<leader>9", "<cmd>lua CopilotChatBuffer()<CR>", { 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",
"<leader>0",
"<cmd>lua ShowCopilotChatActionPrompt()<CR>",
{ noremap = true, silent = true }
)
--cody
require("sg").setup()
vim.keymap.set("n", "<leader>9", ":<C-u>CodyToggle<CR>", { silent = true })
vim.keymap.set("v", "<leader>0", ":CodyTask ")
vim.keymap.set("v", "<leader>-", ":CodyAsk ")
--COLORSCHEME
vim.keymap.set("n", "<leader>8", "<cmd>colorscheme edge<CR>", { noremap = true, silent = true })