diff options
Diffstat (limited to 'ar/.config/TheSiahxyz')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua | 119 | ||||
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua | 48 | ||||
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua (renamed from ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua) | 8 |
3 files changed, 146 insertions, 29 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua index 6ff4ac6..ee97612 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua @@ -260,6 +260,122 @@ return { }, }, { + "greggh/claude-code.nvim", + dependencies = { + "nvim-lua/plenary.nvim", -- Required for git operations + }, + config = function() + require("claude-code").setup({ + -- Terminal window settings + window = { + split_ratio = 0.3, -- Percentage of screen for the terminal window (height for horizontal, width for vertical splits) + position = "vertical", -- Position of the window: "botright", "topleft", "vertical", "float", etc. + enter_insert = true, -- Whether to enter insert mode when opening Claude Code + hide_numbers = true, -- Hide line numbers in the terminal window + hide_signcolumn = true, -- Hide the sign column in the terminal window + + -- Floating window configuration (only applies when position = "float") + float = { + width = "80%", -- Width: number of columns or percentage string + height = "80%", -- Height: number of rows or percentage string + row = "center", -- Row position: number, "center", or percentage string + col = "center", -- Column position: number, "center", or percentage string + relative = "editor", -- Relative to: "editor" or "cursor" + border = "rounded", -- Border style: "none", "single", "double", "rounded", "solid", "shadow" + }, + }, + -- File refresh settings + refresh = { + enable = true, -- Enable file change detection + updatetime = 100, -- updatetime when Claude Code is active (milliseconds) + timer_interval = 1000, -- How often to check for file changes (milliseconds) + show_notifications = true, -- Show notification when files are reloaded + }, + -- Git project settings + git = { + use_git_root = true, -- Set CWD to git root when opening Claude Code (if in git project) + }, + -- Shell-specific settings + shell = { + separator = "&&", -- Command separator used in shell commands + pushd_cmd = "pushd", -- Command to push directory onto stack (e.g., 'pushd' for bash/zsh, 'enter' for nushell) + popd_cmd = "popd", -- Command to pop directory from stack (e.g., 'popd' for bash/zsh, 'exit' for nushell) + }, + -- Command settings + command = "claude", -- Command used to launch Claude Code + -- Command variants + command_variants = { + -- Conversation management + continue = "--continue", -- Resume the most recent conversation + resume = "--resume", -- Display an interactive conversation picker + + -- Output options + verbose = "--verbose", -- Enable verbose logging with full turn-by-turn output + }, + -- Keymaps + keymaps = { + toggle = { + normal = "<C-,>", -- Normal mode keymap for toggling Claude Code, false to disable + terminal = "<C-,>", -- Terminal mode keymap for toggling Claude Code, false to disable + variants = { + continue = "<leader>cC", -- Normal mode keymap for Claude Code with continue flag + verbose = "<leader>cV", -- Normal mode keymap for Claude Code with verbose flag + }, + }, + window_navigation = true, -- Enable window navigation keymaps (<C-h/j/k/l>) + scrolling = true, -- Enable scrolling keymaps (<C-f/b>) for page up/down + }, + }) + end, + }, + { + "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-q>", 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 @@ -340,7 +456,7 @@ return { instructions_file = "avante.md", ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string ---@type Provider - provider = "openai", -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode + provider = "claude", -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode ---@alias Mode "agentic" | "legacy" ---@type Mode mode = "agentic", -- The default mode for interaction. "agentic" uses tools to automatically generate code, "legacy" uses the old planning method to generate code. @@ -351,6 +467,7 @@ return { providers = { claude = { endpoint = "https://api.anthropic.com", + auth_type = "max", -- Set to "max" to sign in with Claude Pro/Max subscription model = "claude-sonnet-4-20250514", timeout = 30000, -- Timeout in milliseconds extra_request_body = { diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua index 993b02c..848bf09 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua @@ -796,21 +796,21 @@ end tell ---@return string symbol, string hlGroup local function mapSymbols(status, is_symlink) local statusMap = { --- stylua: ignore start -[" M"] = { symbol = "✹", hlGroup = "MiniDiffSignChange"}, -- Modified in the working directory -["M "] = { symbol = "•", hlGroup = "MiniDiffSignChange"}, -- modified in index -["MM"] = { symbol = "≠", hlGroup = "MiniDiffSignChange"}, -- modified in both working tree and index -["A "] = { symbol = "+", hlGroup = "MiniDiffSignAdd" }, -- Added to the staging area, new file -["AA"] = { symbol = "≈", hlGroup = "MiniDiffSignAdd" }, -- file is added in both working tree and index -["D "] = { symbol = "-", hlGroup = "MiniDiffSignDelete"}, -- Deleted from the staging area -["AM"] = { symbol = "⊕", hlGroup = "MiniDiffSignChange"}, -- added in working tree, modified in index -["AD"] = { symbol = "-•", hlGroup = "MiniDiffSignChange"}, -- Added in the index and deleted in the working directory -["R "] = { symbol = "→", hlGroup = "MiniDiffSignChange"}, -- Renamed in the index -["U "] = { symbol = "‖", hlGroup = "MiniDiffSignChange"}, -- Unmerged path -["UU"] = { symbol = "⇄", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged -["UA"] = { symbol = "⊕", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged and added in working tree -["??"] = { symbol = "?", hlGroup = "MiniDiffSignDelete"}, -- Untracked files -["!!"] = { symbol = "!", hlGroup = "MiniDiffSignChange"}, -- Ignored files + -- stylua: ignore start + [" M"] = { symbol = "✹", hlGroup = "MiniDiffSignChange"}, -- Modified in the working directory + ["M "] = { symbol = "•", hlGroup = "MiniDiffSignChange"}, -- modified in index + ["MM"] = { symbol = "≠", hlGroup = "MiniDiffSignChange"}, -- modified in both working tree and index + ["A "] = { symbol = "+", hlGroup = "MiniDiffSignAdd" }, -- Added to the staging area, new file + ["AA"] = { symbol = "≈", hlGroup = "MiniDiffSignAdd" }, -- file is added in both working tree and index + ["D "] = { symbol = "-", hlGroup = "MiniDiffSignDelete"}, -- Deleted from the staging area + ["AM"] = { symbol = "⊕", hlGroup = "MiniDiffSignChange"}, -- added in working tree, modified in index + ["AD"] = { symbol = "-•", hlGroup = "MiniDiffSignChange"}, -- Added in the index and deleted in the working directory + ["R "] = { symbol = "→", hlGroup = "MiniDiffSignChange"}, -- Renamed in the index + ["U "] = { symbol = "‖", hlGroup = "MiniDiffSignChange"}, -- Unmerged path + ["UU"] = { symbol = "⇄", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged + ["UA"] = { symbol = "⊕", hlGroup = "MiniDiffSignAdd" }, -- file is unmerged and added in working tree + ["??"] = { symbol = "?", hlGroup = "MiniDiffSignDelete"}, -- Untracked files + ["!!"] = { symbol = "!", hlGroup = "MiniDiffSignChange"}, -- Ignored files -- stylua: ignore end } @@ -927,18 +927,18 @@ end tell ---@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 @@ end tell 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/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/diary.lua index 9ce9124..90528a1 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/snippets/recordings.lua +++ b/ar/.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 }) |
