diff options
Diffstat (limited to 'mac/.config/TheSiahxyz')
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua | 47 | ||||
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua | 18 | ||||
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua (renamed from mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua) | 8 |
3 files changed, 60 insertions, 13 deletions
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua index 6ff4ac6..52ceb01 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua @@ -260,6 +260,53 @@ 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", "t" }, "<C-.>", function() + require("opencode").toggle() + end, { desc = "Toggle opencode" }) + + vim.keymap.set({ "n", "x" }, "go", function() + return require("opencode").operator("@this ") + end, { expr = true, desc = "Add range to opencode" }) + vim.keymap.set("n", "goo", function() + return require("opencode").operator("@this ") .. "_" + end, { expr = true, desc = "Add line to 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, + }, + { "kkrampis/codex.nvim", lazy = true, cmd = { "Codex", "CodexToggle" }, -- Optional: Load only on command execution diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua index be4daa4..a9e39c2 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua @@ -927,18 +927,18 @@ return { ---@param buf_id integer ---@return nil local function updateGitStatus(buf_id) - local cwd = vim.uv.cwd() - if not cwd or not vim.fs.root(cwd, ".git") then + local git_root = vim.fs.root(buf_id, ".git") + if not git_root then return end local currentTime = os.time() - if gitStatusCache[cwd] and currentTime - gitStatusCache[cwd].time < cacheTimeout then - updateMiniWithGit(buf_id, gitStatusCache[cwd].statusMap) + if gitStatusCache[git_root] and currentTime - gitStatusCache[git_root].time < cacheTimeout then + updateMiniWithGit(buf_id, gitStatusCache[git_root].statusMap) else - fetchGitStatus(cwd, function(content) + fetchGitStatus(git_root, function(content) local gitStatusMap = parseGitStatus(content) - gitStatusCache[cwd] = { + gitStatusCache[git_root] = { time = currentTime, statusMap = gitStatusMap, } @@ -979,9 +979,9 @@ return { pattern = "MiniFilesBufferUpdate", callback = function(sii) local bufnr = sii.data.buf_id - local cwd = vim.fn.expand("%:p:h") - if gitStatusCache[cwd] then - updateMiniWithGit(bufnr, gitStatusCache[cwd].statusMap) + local git_root = vim.fs.root(bufnr, ".git") + if git_root and gitStatusCache[git_root] then + updateMiniWithGit(bufnr, gitStatusCache[git_root].statusMap) end end, }) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua index 9ce9124..90528a1 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua @@ -6,8 +6,8 @@ local f = ls.function_node local fmt = require("luasnip.extras.fmt").fmta -local recordings_snippet = s( - "recordings", +local diary_snippet = s( + "diary", fmt( [[--- title: <title> @@ -26,5 +26,5 @@ date: <date> ) ) -ls.add_snippets("markdown", { recordings_snippet }) -ls.add_snippets("quarto", { recordings_snippet }) +ls.add_snippets("markdown", { diary_snippet }) +ls.add_snippets("quarto", { diary_snippet }) |
