Skip to content

Commit 6979a8f

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

File tree

1 file changed

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

1 file changed

+70
-58
lines changed
Lines changed: 70 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,79 @@ 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 = "Sidekick Select Prompt",
37+
}
38+
maps.n["<Tab>"] = {
39+
function()
40+
if not require("sidekick").nes_jump_or_apply() then return "<Tab>" end
41+
end,
42+
expr = true,
43+
desc = "Goto/Apply Next Edit Suggestion",
44+
}
45+
maps.n["<C-.>"] = {
46+
function() require("sidekick.cli").toggle {} end,
47+
desc = "Sidekick Toggle",
48+
}
49+
50+
-- Visual mode mappings
1451
maps.x[prefix] = { desc = require("astroui").get_icon("Sidekick", 1, true) .. "Sidekick" }
52+
maps.x[prefix .. "t"] = {
53+
function() require("sidekick.cli").send { msg = "{this}" } end,
54+
desc = "Send This",
55+
}
56+
maps.x[prefix .. "v"] = {
57+
function() require("sidekick.cli").send { msg = "{selection}" } end,
58+
desc = "Send Visual Selection",
59+
}
60+
maps.x[prefix .. "p"] = {
61+
function() require("sidekick.cli").prompt {} end,
62+
desc = "Sidekick Select Prompt",
63+
}
64+
maps.x["<C-.>"] = {
65+
function() require("sidekick.cli").toggle {} end,
66+
desc = "Sidekick Toggle",
67+
}
68+
69+
-- Insert mode mappings
70+
maps.i["<C-.>"] = {
71+
function() require("sidekick.cli").toggle {} end,
72+
desc = "Sidekick Toggle",
73+
}
74+
75+
-- Terminal mode mappings
76+
maps.t["<C-.>"] = {
77+
function() require("sidekick.cli").toggle {} end,
78+
desc = "Sidekick Toggle",
79+
}
1580
end,
1681
},
17-
{ "AstroNvim/astroui", opts = { icons = { Sidekick = "" } } },
82+
{ "AstroNvim/astroui", opts = { icons = { Sidekick = "" } } },
1883
},
1984
opts = {
2085
nes = {
@@ -26,58 +91,5 @@ return {
2691
},
2792
},
2893
},
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-
},
8394
}
95+

0 commit comments

Comments
 (0)