diff --git a/lua/astrocommunity/ai/sidekick-nivm/README.md b/lua/astrocommunity/ai/sidekick-nivm/README.md new file mode 100644 index 000000000..30271a9d9 --- /dev/null +++ b/lua/astrocommunity/ai/sidekick-nivm/README.md @@ -0,0 +1,5 @@ +# folke/sidekick.nvim + +Your Neovim AI sidekick + +**Repository**: diff --git a/lua/astrocommunity/ai/sidekick-nivm/init.lua b/lua/astrocommunity/ai/sidekick-nivm/init.lua new file mode 100644 index 000000000..72fa8aaef --- /dev/null +++ b/lua/astrocommunity/ai/sidekick-nivm/init.lua @@ -0,0 +1,113 @@ +---@type LazySpec +return { + "folke/sidekick.nvim", + specs = { + { + "AstroNvim/astrocore", + ---@param opts AstroCoreOpts + opts = function(_, opts) + local maps = assert(opts.mappings) + local prefix = "A" + + -- Normal mode mappings + maps.n[prefix] = { desc = require("astroui").get_icon("Sidekick", 1, true) .. "Sidekick" } + maps.n[prefix .. "a"] = { + function() require("sidekick.cli").toggle() end, + desc = "Sidekick Toggle CLI", + } + maps.n[prefix .. "s"] = { + function() require("sidekick.cli").select() end, + desc = "Select CLI", + } + maps.n[prefix .. "d"] = { + function() require("sidekick.cli").close() end, + desc = "Detach a CLI Session", + } + maps.n[prefix .. "t"] = { + function() require("sidekick.cli").send { msg = "{this}" } end, + desc = "Send This", + } + maps.n[prefix .. "f"] = { + function() require("sidekick.cli").send { msg = "{file}" } end, + desc = "Send File", + } + maps.n[prefix .. "p"] = { + function() require("sidekick.cli").prompt() end, + desc = "Select Prompt", + } + + maps.n[prefix .. "n"] = { desc = require("astroui").get_icon("SidekickBrain", 1, true) .. "NES" } + maps.n[prefix .. "nt"] = { + function() require("sidekick.nes").toggle() end, + desc = "Toggle NES", + } + maps.n[prefix .. "ne"] = { + function() require("sidekick.nes").enable() end, + desc = "Enable NES", + } + maps.n[prefix .. "nd"] = { + function() require("sidekick.nes").disable() end, + desc = "Disable NES", + } + maps.n[prefix .. "nu"] = { + function() require("sidekick.nes").update() end, + desc = "Update Suggestions", + } + + maps.n[""] = { + function() + if not require("sidekick").nes_jump_or_apply() then return "" end + end, + expr = true, + desc = "Goto/Apply Next Edit Suggestion", + } + maps.n[""] = { + function() require("sidekick.cli").toggle {} end, + desc = "Sidekick Toggle", + } + + -- Visual mode mappings + maps.x[prefix] = { desc = require("astroui").get_icon("Sidekick", 1, true) .. "Sidekick" } + maps.x[prefix .. "t"] = { + function() require("sidekick.cli").send { msg = "{this}" } end, + desc = "Send This", + } + maps.x[prefix .. "v"] = { + function() require("sidekick.cli").send { msg = "{selection}" } end, + desc = "Send Visual Selection", + } + maps.x[prefix .. "p"] = { + function() require("sidekick.cli").prompt {} end, + desc = "Select Prompt", + } + maps.x[""] = { + function() require("sidekick.cli").toggle {} end, + desc = "Sidekick Toggle", + } + + -- Insert mode mappings + maps.i[""] = { + function() require("sidekick.cli").toggle {} end, + desc = "Sidekick Toggle", + } + + -- Terminal mode mappings + maps.t[""] = { + function() require("sidekick.cli").toggle {} end, + desc = "Sidekick Toggle", + } + end, + }, + { "AstroNvim/astroui", opts = { icons = { Sidekick = "", SidekickBrain = "󰧑" } } }, + }, + opts = { + nes = { + enabled = true, -- If the user doesn't have the copilot LSP running internally this gets set as false + }, + cli = { + mux = { + enabled = true, + }, + }, + }, +}