My nvim configuration
fix(claude): commands show in chat
2 files changed, +28 -3
+20-1claude-nvim/lua/claude/runner.lua
| @@ -134,7 +134,26 @@ local function handle_event(sid, evt) | ||
| 134 | 134 | if path and FILE_TOOLS[block.name] then |
| 135 | 135 | ensure_before(sid, path) |
| 136 | 136 | end |
| 137 | - ui.append_tool_use(sid, block.name or "tool", path or "") | |
| 137 | + local summary | |
| 138 | + local name = block.name or "tool" | |
| 139 | + if name == "Bash" then | |
| 140 | + summary = input.command or "" | |
| 141 | + elseif name == "Grep" or name == "Glob" then | |
| 142 | + summary = input.pattern or "" | |
| 143 | + elseif name == "Task" then | |
| 144 | + summary = input.description or "" | |
| 145 | + elseif name == "WebFetch" or name == "WebSearch" then | |
| 146 | + summary = input.url or input.query or "" | |
| 147 | + elseif name == "TodoWrite" then | |
| 148 | + summary = "(todos)" | |
| 149 | + elseif name == "Edit" or name == "MultiEdit" then | |
| 150 | + summary = path or input.file_path or "" | |
| 151 | + else | |
| 152 | + summary = path or input.file_path or input.command or input.pattern or input.query or "" | |
| 153 | + end | |
| 154 | + summary = (summary or ""):gsub("\n", " ") | |
| 155 | + if #summary > 200 then summary = summary:sub(1, 200) .. "…" end | |
| 156 | + ui.append_tool_use(sid, name, summary) | |
| 138 | 157 | end |
| 139 | 158 | end |
| 140 | 159 | end |
+8-2claude-nvim/lua/claude/ui.lua
| @@ -512,10 +512,16 @@ function M.append_assistant_text(sid, text) | ||
| 512 | 512 | end) |
| 513 | 513 | end |
| 514 | 514 | |
| 515 | -function M.append_tool_use(sid, name, path) | |
| 515 | +function M.append_tool_use(sid, name, summary) | |
| 516 | 516 | if sid ~= panel.sid then return end |
| 517 | 517 | vim.schedule(function() |
| 518 | - append_lines({ "", "> **" .. name .. "** `" .. path .. "`", "" }) | |
| 518 | + local line | |
| 519 | + if summary and summary ~= "" then | |
| 520 | + line = "> **" .. name .. "** `" .. summary .. "`" | |
| 521 | + else | |
| 522 | + line = "> **" .. name .. "**" | |
| 523 | + end | |
| 524 | + append_lines({ "", line, "" }) | |
| 519 | 525 | spinner_render() |
| 520 | 526 | end) |
| 521 | 527 | end |