Kacper Marzecki 656898074e safety
2026-08-02 00:39:29 +02:00

231 lines
8.4 KiB
Lua

return {
{
"olimorris/codecompanion.nvim",
enabled = vim.loop.os_uname().sysname == "Darwin",
opts = {},
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
"zbirenbaum/copilot.lua",
enabled = vim.loop.os_uname().sysname == "Darwin",
optional = false,
opts = function()
require("copilot.api").status = require("copilot.status")
return {
suggestion = {
auto_trigger = true,
debounce = 100,
keymap = {
accept = "<C-e>",
next = "<C-n>",
prev = "<C-p>",
dismiss = "<C-d>",
},
},
-- panel = {
-- enabled = false,
-- auto_refresh = true,
-- keymap = {
-- jump_next = "<C-n>",
-- jump_prev = "<C-p>",
-- accept = "<C-e>",
-- refresh = "r",
-- open = "<M-p>",
-- },
-- },
}
end,
},
{
"coder/claudecode.nvim",
dependencies = { "folke/snacks.nvim" },
config = true,
keys = {
{ "<leader>a", nil, desc = "AI/Claude Code" },
{ "<leader>ac", "<cmd>ClaudeCode<cr>", desc = "Toggle Claude" },
{ "<leader>af", "<cmd>ClaudeCodeFocus<cr>", desc = "Focus Claude" },
{ "<leader>ar", "<cmd>ClaudeCode --resume<cr>", desc = "Resume Claude" },
{ "<leader>aC", "<cmd>ClaudeCode --continue<cr>", desc = "Continue Claude" },
{ "<leader>am", "<cmd>ClaudeCodeSelectModel<cr>", desc = "Select Claude model" },
{ "<leader>ab", "<cmd>ClaudeCodeAdd %<cr>", desc = "Add current buffer" },
{ "<leader>as", "<cmd>ClaudeCodeSend<cr>", mode = "v", desc = "Send to Claude" },
{
"<leader>as",
"<cmd>ClaudeCodeTreeAdd<cr>",
desc = "Add file",
ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" },
},
-- Diff management
{ "<leader>aa", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
{ "<leader>ad", "<cmd>ClaudeCodeDiffDeny<cr>", desc = "Deny diff" },
},
},
{
"ThePrimeagen/99",
config = function()
local _99 = require("99")
-- For logging that is to a file if you wish to trace through requests
-- for reporting bugs, i would not rely on this, but instead the provided
-- logging mechanisms within 99. This is for more debugging purposes
local cwd = vim.uv.cwd()
local basename = vim.fs.basename(cwd)
_99.setup({
provider = _99.Providers.ClaudeCodeProvider, -- default: OpenCodeProvider
logger = {
level = _99.DEBUG,
path = "/tmp/" .. basename .. ".99.debug",
print_on_error = true,
},
-- When setting this to something that is not inside the CWD tools
-- such as claude code or opencode will have permission issues
-- and generation will fail refer to tool documentation to resolve
-- https://opencode.ai/docs/permissions/#external-directories
-- https://code.claude.com/docs/en/permissions#read-and-edit
tmp_dir = "./tmp",
--- Completions: #rules and @files in the prompt buffer
completion = {
-- I am going to disable these until i understand the
-- problem better. Inside of cursor rules there is also
-- application rules, which means i need to apply these
-- differently
-- cursor_rules = "<custom path to cursor rules>"
--- A list of folders where you have your own SKILL.md
--- Expected format:
--- /path/to/dir/<skill_name>/SKILL.md
---
--- Example:
--- Input Path:
--- "scratch/custom_rules/"
---
--- Output Rules:
--- {path = "scratch/custom_rules/vim/SKILL.md", name = "vim"},
--- ... the other rules in that dir ...
---
custom_rules = {
-- "scratch/custom_rules/",
},
--- Configure @file completion (all fields optional, sensible defaults)
files = {
-- enabled = true,
-- max_file_size = 102400, -- bytes, skip files larger than this
-- max_files = 5000, -- cap on total discovered files
-- exclude = { ".env", ".env.*", "node_modules", ".git", ... },
},
--- File Discovery:
--- - In git repos: Uses `git ls-files` which automatically respects .gitignore
--- - Non-git repos: Falls back to filesystem scanning with manual excludes
--- - Both methods apply the configured `exclude` list on top of gitignore
--- What autocomplete engine to use. Defaults to native (built-in) if not specified.
source = "native", -- "native" (default), "cmp", or "blink"
},
--- WARNING: if you change cwd then this is likely broken
--- ill likely fix this in a later change
---
--- md_files is a list of files to look for and auto add based on the location
--- of the originating request. That means if you are at /foo/bar/baz.lua
--- the system will automagically look for:
--- /foo/bar/AGENT.md
--- /foo/AGENT.md
--- assuming that /foo is project root (based on cwd)
md_files = {
"AGENT.md",
},
})
-- take extra note that i have visual selection only in v mode
-- technically whatever your last visual selection is, will be used
-- so i have this set to visual mode so i dont screw up and use an
-- old visual selection
--
-- likely ill add a mode check and assert on required visual mode
-- so just prepare for it now
vim.keymap.set("v", "<leader>9v", function()
_99.visual()
end)
--- if you have a request you dont want to make any changes, just cancel it
vim.keymap.set("n", "<leader>9x", function()
_99.stop_all_requests()
end)
vim.keymap.set("n", "<leader>9s", function()
_99.search()
end)
end,
},
{
"nickjvandyke/opencode.nvim",
version = "*", -- Latest stable release
dependencies = {
{
-- `snacks.nvim` integration is recommended, but optional
---@module "snacks" <- Loads `snacks.nvim` types for configuration intellisense
"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`
-- 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", "t" }, "<C-.>", function()
require("opencode").toggle()
end, { desc = "Toggle opencode" })
vim.keymap.set({ "n", "x" }, "go", function()
return require("opencode").operator("@this ")
end, { desc = "Add range to opencode", expr = true })
vim.keymap.set("n", "goo", function()
return require("opencode").operator("@this ") .. "_"
end, { desc = "Add line to opencode", expr = true })
vim.keymap.set("n", "<S-C-u>", function()
require("opencode").command("session.half.page.up")
end, { desc = "Scroll opencode up" })
vim.keymap.set("n", "<S-C-d>", function()
require("opencode").command("session.half.page.down")
end, { desc = "Scroll opencode down" })
-- You may want these if you use the opinionated `<C-a>` and `<C-x>` keymaps above — otherwise consider `<leader>o…` (and remove terminal mode from the `toggle` keymap)
vim.keymap.set("n", "+", "<C-a>", { desc = "Increment under cursor", noremap = true })
vim.keymap.set("n", "-", "<C-x>", { desc = "Decrement under cursor", noremap = true })
end,
},
}