mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-24 13:31:06 +00:00
feat(extra) adding opencode to extra ia
This commit is contained in:
parent
c64a61734f
commit
49bfae849c
1 changed files with 43 additions and 0 deletions
43
lua/lazyvim/plugins/extras/ai/opencode.lua
Normal file
43
lua/lazyvim/plugins/extras/ai/opencode.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"NickvanDyke/opencode.nvim",
|
||||||
|
dependencies = {
|
||||||
|
-- Recommended for `ask()` and `select()`.
|
||||||
|
-- Required for `snacks` provider.
|
||||||
|
---@module 'snacks' <- Loads `snacks.nvim` types for configuration intellisense.
|
||||||
|
{ "folke/snacks.nvim", opts = { input = {}, picker = {}, terminal = {} } },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
---@type opencode.Opts
|
||||||
|
vim.g.opencode_opts = {
|
||||||
|
-- Your configuration, if any — see `lua/opencode/config.lua`, or "goto definition".
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Required for `opts.events.reload`.
|
||||||
|
vim.o.autoread = true
|
||||||
|
|
||||||
|
-- Recommended/example keymaps.
|
||||||
|
vim.keymap.set({ "n", "x" }, "<C-a>", function()
|
||||||
|
require("opencode").ask("@this: ", { submit = true })
|
||||||
|
end, { desc = "Ask opencode" })
|
||||||
|
vim.keymap.set({ "n", "x" }, "<C-x>", function()
|
||||||
|
require("opencode").select()
|
||||||
|
end, { desc = "Execute opencode action…" })
|
||||||
|
vim.keymap.set({ "n", "x" }, "ga", function()
|
||||||
|
require("opencode").prompt("@this")
|
||||||
|
end, { desc = "Add to opencode" })
|
||||||
|
vim.keymap.set({ "n", "t" }, "<C-.>", function()
|
||||||
|
require("opencode").toggle()
|
||||||
|
end, { desc = "Toggle opencode" })
|
||||||
|
vim.keymap.set("n", "<S-C-u>", function()
|
||||||
|
require("opencode").command("session.half.page.up")
|
||||||
|
end, { desc = "opencode half page up" })
|
||||||
|
vim.keymap.set("n", "<S-C-d>", function()
|
||||||
|
require("opencode").command("session.half.page.down")
|
||||||
|
end, { desc = "opencode half page down" })
|
||||||
|
-- You may want these if you stick with the opinionated "<C-a>" and "<C-x>" above — otherwise consider "<leader>o".
|
||||||
|
vim.keymap.set("n", "+", "<C-a>", { desc = "Increment", noremap = true })
|
||||||
|
vim.keymap.set("n", "-", "<C-x>", { desc = "Decrement", noremap = true })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue