Add chatgpt.nvim

This commit is contained in:
Tyler Hallada 2024-05-21 01:05:29 -04:00
parent 4a4ffccfe8
commit b1092bbba7
2 changed files with 51 additions and 0 deletions

View File

@ -1,4 +1,5 @@
{
"ChatGPT.nvim": { "branch": "main", "commit": "df53728e05129278d6ea26271ec086aa013bed90" },
"LazyVim": { "branch": "main", "commit": "50626e30925909450bbfe934d1a50e1d34d007c7" },
"LuaSnip": { "branch": "master", "commit": "de1a287c9cb525ae52bc846e8f6207e5ef1da5ac" },
"SchemaStore.nvim": { "branch": "main", "commit": "de73a884679a2461c53f96035894ef073a5a7f4f" },

50
lua/plugins/chatgpt.lua Normal file
View File

@ -0,0 +1,50 @@
return {
"jackMort/ChatGPT.nvim",
event = "VeryLazy",
opts = {
api_key_cmd = "cat" .. os.getenv("HOME") .. "/.config/.openai-api-key",
popup_input = {
submit = "<C-s>",
},
openai_params = {
model = "gpt-4o",
},
openai_edit_params = {
model = "gpt-4o",
},
},
keys = {
{ "<leader>kc", "<cmd>ChatGPT<CR>", desc = "ChatGPT" },
{ "<leader>ke", "<cmd>ChatGPTEditWithInstruction<CR>", desc = "Edit with instruction", mode = { "n", "v" } },
{ "<leader>kg", "<cmd>ChatGPTRun grammar_correction<CR>", desc = "Grammar Correction", mode = { "n", "v" } },
{ "<leader>kt", "<cmd>ChatGPTRun translate<CR>", desc = "Translate", mode = { "n", "v" } },
{ "<leader>kk", "<cmd>ChatGPTRun keywords<CR>", desc = "Keywords", mode = { "n", "v" } },
{ "<leader>kd", "<cmd>ChatGPTRun docstring<CR>", desc = "Docstring", mode = { "n", "v" } },
{ "<leader>ka", "<cmd>ChatGPTRun add_tests<CR>", desc = "Add Tests", mode = { "n", "v" } },
{ "<leader>ko", "<cmd>ChatGPTRun optimize_code<CR>", desc = "Optimize Code", mode = { "n", "v" } },
{ "<leader>ks", "<cmd>ChatGPTRun summarize<CR>", desc = "Summarize", mode = { "n", "v" } },
{ "<leader>kf", "<cmd>ChatGPTRun fix_bugs<CR>", desc = "Fix Bugs", mode = { "n", "v" } },
{ "<leader>kx", "<cmd>ChatGPTRun explain_code<CR>", desc = "Explain Code", mode = { "n", "v" } },
{
"<leader>kl",
"<cmd>ChatGPTRun code_readability_analysis<CR>",
desc = "Code Readability Analysis",
mode = { "n", "v" },
},
},
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"folke/trouble.nvim",
"nvim-telescope/telescope.nvim",
{
"folke/which-key.nvim",
optional = true,
opts = {
defaults = {
["<leader>k"] = { name = "+ChatGPT" },
},
},
},
},
}