From e48e840ebcd5ec31fd6a1bd6e9acb63f503a2223 Mon Sep 17 00:00:00 2001 From: KamilCuk Date: Fri, 21 Jun 2024 18:41:42 +0200 Subject: [PATCH] feat(chatgpt-nvim): add which-key mappings below G (#1051) * feat(chatgpt-nvim): add which-key mappings below G * feat(chatgpt-nvim): Add icon for chatGPT * fix(chatgpt-nvim): Fix mappings for the different modes * Update lua/astrocommunity/editing-support/chatgpt-nvim/init.lua Co-authored-by: Maxime Brunet * fix(chatgpt-nvim): Remove sneaky comma --------- Co-authored-by: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Co-authored-by: Maxime Brunet --- .../editing-support/chatgpt-nvim/init.lua | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lua/astrocommunity/editing-support/chatgpt-nvim/init.lua b/lua/astrocommunity/editing-support/chatgpt-nvim/init.lua index 5b22ed5bd..f1a5fa5f6 100644 --- a/lua/astrocommunity/editing-support/chatgpt-nvim/init.lua +++ b/lua/astrocommunity/editing-support/chatgpt-nvim/init.lua @@ -5,6 +5,54 @@ return { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", + { + "AstroNvim/astrocore", + opts = function(_, opts) + local maps = opts.mappings + local prefix = "G" + maps.n[prefix] = { desc = require("astroui").get_icon("ChatGPT", 1, true) .. "ChatGPT" } + maps.v[prefix] = { desc = require("astroui").get_icon("ChatGPT", 1, true) .. "ChatGPT" } + maps.n[prefix .. "c"] = { "ChatGPT", desc = "ChatGPT" } + maps.n[prefix .. "C"] = { "ChatGPTActAs", desc = "ChatGPT Acts As ..." } + + maps.n[prefix .. "e"] = { "ChatGPTEditWithInstruction", desc = "Edit with instruction" } + maps.v[prefix .. "e"] = { "ChatGPTEditWithInstruction", desc = "Edit with instruction" } + + maps.n[prefix .. "g"] = { "ChatGPTRun grammar_correction", desc = "Grammar Correction" } + maps.v[prefix .. "g"] = { "ChatGPTRun grammar_correction", desc = "Grammar Correction" } + + maps.n[prefix .. "t"] = { "ChatGPTRun translate", desc = "Translate" } + maps.v[prefix .. "t"] = { "ChatGPTRun translate", desc = "Translate" } + + maps.n[prefix .. "k"] = { "ChatGPTRun keywords", desc = "Keywords" } + maps.v[prefix .. "k"] = { "ChatGPTRun keywords", desc = "Keywords" } + + maps.n[prefix .. "d"] = { "ChatGPTRun docstring", desc = "Docstring" } + maps.v[prefix .. "d"] = { "ChatGPTRun docstring", desc = "Docstring" } + + maps.n[prefix .. "a"] = { "ChatGPTRun add_tests", desc = "Add Tests" } + maps.v[prefix .. "a"] = { "ChatGPTRun add_tests", desc = "Add Tests" } + + maps.n[prefix .. "o"] = { "ChatGPTRun optimize_code", desc = "Optimize Code" } + maps.v[prefix .. "o"] = { "ChatGPTRun optimize_code", desc = "Optimize Code" } + + maps.n[prefix .. "s"] = { "ChatGPTRun summarize", desc = "Summarize" } + maps.v[prefix .. "s"] = { "ChatGPTRun summarize", desc = "Summarize" } + + maps.n[prefix .. "f"] = { "ChatGPTRun fix_bugs", desc = "Fix Bugs" } + maps.v[prefix .. "f"] = { "ChatGPTRun fix_bugs", desc = "Fix Bugs" } + + maps.n[prefix .. "x"] = { "ChatGPTRun explain_code", desc = "Explain Code" } + maps.v[prefix .. "x"] = { "ChatGPTRun explain_code", desc = "Explain Code" } + + maps.n[prefix .. "r"] = { "ChatGPTRun roxygen_edit", desc = "Roxygen Edit" } + maps.v[prefix .. "r"] = { "ChatGPTRun roxygen_edit", desc = "Roxygen Edit" } + + maps.n[prefix .. "l"] = { "ChatGPTRun code_readability_analysis", desc = "Code Readability Analysis" } + maps.v[prefix .. "l"] = { "ChatGPTRun code_readability_analysis", desc = "Code Readability Analysis" } + end, + }, + { "AstroNvim/astroui", opts = { icons = { ChatGPT = "󰭹" } } }, }, opts = {}, }