irongit

My nvim configuration

refactor(claude): remove git blame like feature, set nonjumpable title text for quickfix list (the prompt), and use git like changes in quickfix list entries

huncholanehuncholaneauthored
parent f870716commit 4725f3fb8f1267747dc7bbe5699853b5984e00a9Browse files

3 files changed, +18 -18

+4-12claude-nvim/lua/claude/highlights.lua
@@ -1,15 +1,12 @@
11 local M = {}
22
33 local ns = vim.api.nvim_create_namespace("claude_changes")
4-local cfg = { highlight = true, blame = true }
4+local cfg = { highlight = true }
55
66 function M.setup(opts)
77 cfg.highlight = opts.highlight ~= false
8- cfg.blame = opts.blame ~= false
98
109 vim.api.nvim_set_hl(0, "ClaudeChange", { default = true, bg = "#3a2410" })
11- vim.api.nvim_set_hl(0, "ClaudeChangeSign", { default = true, fg = "#e07b00" })
12- vim.api.nvim_set_hl(0, "ClaudeBlame", { default = true, fg = "#7f5a2a", italic = true })
1310
1411 vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "BufEnter" }, {
1512 callback = function(args)
@@ -49,7 +46,7 @@ end
4946
5047 function M.apply_to_buf(buf)
5148 if not vim.api.nvim_buf_is_valid(buf) then return end
52- if not (cfg.highlight or cfg.blame) then return end
49+ if not cfg.highlight then return end
5350 local name = vim.api.nvim_buf_get_name(buf)
5451 if name == "" then return end
5552 if vim.bo[buf].buftype ~= "" then return end
@@ -63,14 +60,9 @@ function M.apply_to_buf(buf)
6360 local e = math.min(lc - 1, (h.finish or h.start or 1) - 1)
6461 if e < s then e = s end
6562 for ln = s, e do
66- local opts = {}
67- if cfg.highlight then opts.line_hl_group = "ClaudeChange" end
68- if cfg.blame and ln == s then
69- local snippet = (h.prompt or ""):gsub("%s+", " "):sub(1, 80)
70- opts.virt_text = { { " ▏ " .. snippet, "ClaudeBlame" } }
71- opts.virt_text_pos = "eol"
63+ if cfg.highlight then
64+ pcall(vim.api.nvim_buf_set_extmark, buf, ns, ln, 0, { line_hl_group = "ClaudeChange" })
7265 end
73- pcall(vim.api.nvim_buf_set_extmark, buf, ns, ln, 0, opts)
7466 end
7567 end
7668 end
+12-5claude-nvim/lua/claude/pickers.lua
@@ -10,11 +10,19 @@ function M.set_qf_from_prompt(p)
1010 local items = {}
1111 for _, f in ipairs(p.files or {}) do
1212 for _, h in ipairs(f.hunks or {}) do
13+ local added = h.added or 0
14+ local removed = h.removed or 0
15+ local stats
16+ if added == 0 and removed == 0 then
17+ stats = ""
18+ else
19+ stats = string.format("+%d -%d", added, removed)
20+ end
1321 table.insert(items, {
1422 filename = f.path,
1523 lnum = h.start or 1,
1624 end_lnum = h.finish or h.start or 1,
17- text = snippet(p.text, 80),
25+ text = stats,
1826 })
1927 end
2028 end
@@ -22,10 +30,9 @@ function M.set_qf_from_prompt(p)
2230 vim.notify("claude: prompt has no recorded changes", vim.log.levels.WARN)
2331 return
2432 end
25- vim.fn.setqflist({}, " ", {
26- title = "Claude: " .. snippet(p.text, 60),
27- items = items,
28- })
33+ local title = (p.text or ""):gsub("%s+", " ")
34+ table.insert(items, 1, { text = "▌ " .. title, valid = 0 })
35+ vim.fn.setqflist({}, " ", { title = title, items = items })
2936 vim.cmd("copen")
3037 pcall(function() require("claude.highlights").refresh_all() end)
3138 end
+2-1claude-nvim/lua/claude/runner.lua
@@ -43,6 +43,7 @@ local function compute_change(before, after)
4343 local hunks = {}
4444 if type(indices) == "table" then
4545 for _, h in ipairs(indices) do
46+ local count_a = h[2]
4647 local start_b = h[3]
4748 local count_b = h[4]
4849 local s, e
@@ -53,7 +54,7 @@ local function compute_change(before, after)
5354 s = start_b
5455 e = start_b + count_b - 1
5556 end
56- table.insert(hunks, { start = s, finish = e })
57+ table.insert(hunks, { start = s, finish = e, added = count_b, removed = count_a })
5758 end
5859 end
5960 if #hunks == 0 then return nil end