2025-12-08 02:40:50 +01:00
|
|
|
return {
|
|
|
|
|
"NickvanDyke/opencode.nvim",
|
|
|
|
|
config = function()
|
2026-03-25 01:03:37 +01:00
|
|
|
local function open_opencode_in_kitty_tab()
|
|
|
|
|
vim.fn.jobstart({
|
|
|
|
|
"kitty",
|
|
|
|
|
"@",
|
|
|
|
|
"launch",
|
|
|
|
|
"--type=tab",
|
|
|
|
|
"--cwd",
|
|
|
|
|
vim.fn.getcwd(),
|
|
|
|
|
"sh",
|
|
|
|
|
"-lc",
|
|
|
|
|
"opencode --port",
|
|
|
|
|
}, { detach = true })
|
|
|
|
|
end
|
|
|
|
|
|
2025-12-08 02:40:50 +01:00
|
|
|
---@type opencode.Opts
|
|
|
|
|
vim.g.opencode_opts = {
|
2026-03-25 01:03:37 +01:00
|
|
|
server = {
|
|
|
|
|
start = open_opencode_in_kitty_tab,
|
|
|
|
|
toggle = open_opencode_in_kitty_tab,
|
|
|
|
|
stop = function() end,
|
2025-12-08 14:06:51 +01:00
|
|
|
},
|
|
|
|
|
events = {
|
|
|
|
|
permissions = {
|
|
|
|
|
enabled = false
|
|
|
|
|
}
|
2025-12-08 02:40:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
vim.o.autoread = true
|
|
|
|
|
|
2026-03-25 01:03:37 +01:00
|
|
|
vim.keymap.set({ "n", "x" }, "<leader>oa", function()
|
2025-12-08 02:40:50 +01:00
|
|
|
require("opencode").ask("@this: ", { submit = true })
|
|
|
|
|
end, { desc = "Ask opencode" })
|
|
|
|
|
|
2026-03-25 01:03:37 +01:00
|
|
|
vim.keymap.set({ "n", "x" }, "<leader>oo", function()
|
2025-12-08 02:40:50 +01:00
|
|
|
require("opencode").select()
|
|
|
|
|
end, { desc = "Execute opencode action…" })
|
|
|
|
|
|
2026-03-25 01:03:37 +01:00
|
|
|
vim.keymap.set({ "n", "x" }, "<leader>os", function()
|
2025-12-08 02:40:50 +01:00
|
|
|
require("opencode").prompt("@this")
|
|
|
|
|
end, { desc = "Add to opencode" })
|
|
|
|
|
|
2026-03-25 01:03:37 +01:00
|
|
|
vim.keymap.set({ "n", "t" }, "<leader>o.", function()
|
2025-12-08 02:40:50 +01:00
|
|
|
require("opencode").toggle()
|
|
|
|
|
end, { desc = "Toggle opencode" })
|
|
|
|
|
end,
|
|
|
|
|
}
|