feat: Some other changes in my config
This commit is contained in:
@@ -150,4 +150,80 @@ return {
|
||||
"github/copilot.vim",
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
"nickjvandyke/opencode.nvim",
|
||||
version = "*", -- Latest stable release
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
input = {}, -- Enhances `ask()`
|
||||
picker = { -- Enhances `select()`
|
||||
actions = {
|
||||
opencode_send = function(...)
|
||||
return require("opencode").snacks_picker_send(...)
|
||||
end,
|
||||
},
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
["<a-a>"] = { "opencode_send", mode = { "n", "i" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
---@type opencode.Opts
|
||||
vim.g.opencode_opts = {
|
||||
-- Your configuration, if any; goto definition on the type or field for details
|
||||
}
|
||||
|
||||
vim.o.autoread = true -- Required for `opts.events.reload`
|
||||
|
||||
local o = function()
|
||||
return require "opencode"
|
||||
end
|
||||
|
||||
-- Toggle Opencode panel
|
||||
vim.keymap.set({ "n", "t" }, "<leader>ct", function()
|
||||
o().toggle()
|
||||
end, { desc = "Opencode: Toggle panel" })
|
||||
|
||||
-- Ask (submit selection)
|
||||
vim.keymap.set({ "n", "x" }, "<leader>ca", function()
|
||||
o().ask("@this: ", { submit = true })
|
||||
end, { desc = "Opencode: Ask selection" })
|
||||
|
||||
-- Execute action
|
||||
vim.keymap.set({ "n", "x" }, "<leader>ce", function()
|
||||
o().select()
|
||||
end, { desc = "Opencode: Execute action" })
|
||||
|
||||
-- Send selection
|
||||
vim.keymap.set({ "n", "x" }, "<leader>cs", function()
|
||||
return o().operator "@this "
|
||||
end, { expr = true, desc = "Opencode: Send selection" })
|
||||
|
||||
-- Send current line
|
||||
vim.keymap.set("n", "<leader>cl", function()
|
||||
return o().operator "@this " .. "_"
|
||||
end, { expr = true, desc = "Opencode: Send line" })
|
||||
|
||||
-- Scroll up in Opencode panel
|
||||
vim.keymap.set("n", "<leader>cu", function()
|
||||
o().command "session.half.page.up"
|
||||
end, { desc = "Opencode: Scroll up" })
|
||||
|
||||
-- Scroll down in Opencode panel
|
||||
vim.keymap.set("n", "<leader>cd", function()
|
||||
o().command "session.half.page.down"
|
||||
end, { desc = "Opencode: Scroll down" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user