Skip to content

Commit 1be89b9

Browse files
committed
feat: add folke/sidekick.nvim
1 parent b3680f2 commit 1be89b9

File tree

1 file changed

+88
-58
lines changed
  • lua/astrocommunity/ai/sidekick-nivm

1 file changed

+88
-58
lines changed
Lines changed: 88 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
local cli_tool = vim.g.sidekick_cli_tool or "opencode"
2-
local prefix = "<Leader>A"
3-
41
---@type LazySpec
52
return {
63
"folke/sidekick.nvim",
@@ -10,11 +7,98 @@ return {
107
---@param opts AstroCoreOpts
118
opts = function(_, opts)
129
local maps = assert(opts.mappings)
10+
local prefix = "<Leader>A"
11+
12+
-- Normal mode mappings
1313
maps.n[prefix] = { desc = require("astroui").get_icon("Sidekick", 1, true) .. "Sidekick" }
14+
maps.n[prefix .. "a"] = {
15+
function() require("sidekick.cli").toggle() end,
16+
desc = "Sidekick Toggle CLI",
17+
}
18+
maps.n[prefix .. "s"] = {
19+
function() require("sidekick.cli").select() end,
20+
desc = "Select CLI",
21+
}
22+
maps.n[prefix .. "d"] = {
23+
function() require("sidekick.cli").close() end,
24+
desc = "Detach a CLI Session",
25+
}
26+
maps.n[prefix .. "t"] = {
27+
function() require("sidekick.cli").send { msg = "{this}" } end,
28+
desc = "Send This",
29+
}
30+
maps.n[prefix .. "f"] = {
31+
function() require("sidekick.cli").send { msg = "{file}" } end,
32+
desc = "Send File",
33+
}
34+
maps.n[prefix .. "p"] = {
35+
function() require("sidekick.cli").prompt() end,
36+
desc = "Select Prompt",
37+
}
38+
39+
maps.n[prefix .. "n"] = { desc = require("astroui").get_icon("SidekickBrain", 1, true) .. "NES" }
40+
maps.n[prefix .. "nt"] = {
41+
function() require("sidekick.nes").toggle() end,
42+
desc = "Toggle NES",
43+
}
44+
maps.n[prefix .. "ne"] = {
45+
function() require("sidekick.nes").enable() end,
46+
desc = "Enable NES",
47+
}
48+
maps.n[prefix .. "nd"] = {
49+
function() require("sidekick.nes").disable() end,
50+
desc = "Disable NES",
51+
}
52+
maps.n[prefix .. "nu"] = {
53+
function() require("sidekick.nes").update() end,
54+
desc = "Update Suggestions",
55+
}
56+
57+
maps.n["<Tab>"] = {
58+
function()
59+
if not require("sidekick").nes_jump_or_apply() then return "<Tab>" end
60+
end,
61+
expr = true,
62+
desc = "Goto/Apply Next Edit Suggestion",
63+
}
64+
maps.n["<C-.>"] = {
65+
function() require("sidekick.cli").toggle {} end,
66+
desc = "Sidekick Toggle",
67+
}
68+
69+
-- Visual mode mappings
1470
maps.x[prefix] = { desc = require("astroui").get_icon("Sidekick", 1, true) .. "Sidekick" }
71+
maps.x[prefix .. "t"] = {
72+
function() require("sidekick.cli").send { msg = "{this}" } end,
73+
desc = "Send This",
74+
}
75+
maps.x[prefix .. "v"] = {
76+
function() require("sidekick.cli").send { msg = "{selection}" } end,
77+
desc = "Send Visual Selection",
78+
}
79+
maps.x[prefix .. "p"] = {
80+
function() require("sidekick.cli").prompt {} end,
81+
desc = "Select Prompt",
82+
}
83+
maps.x["<C-.>"] = {
84+
function() require("sidekick.cli").toggle {} end,
85+
desc = "Sidekick Toggle",
86+
}
87+
88+
-- Insert mode mappings
89+
maps.i["<C-.>"] = {
90+
function() require("sidekick.cli").toggle {} end,
91+
desc = "Sidekick Toggle",
92+
}
93+
94+
-- Terminal mode mappings
95+
maps.t["<C-.>"] = {
96+
function() require("sidekick.cli").toggle {} end,
97+
desc = "Sidekick Toggle",
98+
}
1599
end,
16100
},
17-
{ "AstroNvim/astroui", opts = { icons = { Sidekick = "" } } },
101+
{ "AstroNvim/astroui", opts = { icons = { Sidekick = "", SidekickBrain = "󰧑" } } },
18102
},
19103
opts = {
20104
nes = {
@@ -26,58 +110,4 @@ return {
26110
},
27111
},
28112
},
29-
keys = {
30-
{
31-
"<tab>",
32-
function()
33-
if not require("sidekick").nes_jump_or_apply() then return "<Tab>" end
34-
end,
35-
expr = true,
36-
desc = "Goto/Apply Next Edit Suggestion",
37-
},
38-
{
39-
"<c-.>",
40-
function() require("sidekick.cli").toggle { name = cli_tool } end,
41-
desc = "Sidekick Toggle",
42-
mode = { "n", "t", "i", "x" },
43-
},
44-
{
45-
prefix .. "a",
46-
function() require("sidekick.cli").toggle { name = cli_tool } end,
47-
desc = "Sidekick Toggle CLI",
48-
},
49-
{
50-
prefix .. "s",
51-
function() require("sidekick.cli").select { name = cli_tool } end,
52-
desc = "Select CLI",
53-
},
54-
{
55-
prefix .. "d",
56-
function() require("sidekick.cli").close { name = cli_tool } end,
57-
desc = "Detach a CLI Session",
58-
},
59-
{
60-
prefix .. "t",
61-
function() require("sidekick.cli").send { name = cli_tool, msg = "{this}" } end,
62-
mode = { "x", "n" },
63-
desc = "Send This",
64-
},
65-
{
66-
prefix .. "f",
67-
function() require("sidekick.cli").send { name = cli_tool, msg = "{file}" } end,
68-
desc = "Send File",
69-
},
70-
{
71-
prefix .. "v",
72-
function() require("sidekick.cli").send { name = cli_tool, msg = "{selection}" } end,
73-
mode = { "x" },
74-
desc = "Send Visual Selection",
75-
},
76-
{
77-
prefix .. "p",
78-
function() require("sidekick.cli").prompt { name = cli_tool } end,
79-
mode = { "n", "x" },
80-
desc = "Sidekick Select Prompt",
81-
},
82-
},
83113
}

0 commit comments

Comments
 (0)