Vim Mode: Unexpected Behavior with Line Deletion and Yank/Undo Operations
Status Fixed / completed
Maintainer reply ✓ Yes — sid374
Activity 9 comments · opened Apr 7, 2025 · closed Jun 10, 2025
💡 Likely answer: A maintainer (sid374, contributor)
responded on this thread — see the highlighted reply below.
Bug Description
I can use "dd" to delete a line in vim mode, but I cannot undo or paste that line if I accdentally delete. Also, DD deletes _the whole message_ rather than the forcefully wrapped line that I'm currently on which is quite confusing.
Environment Info
- Platform: macos
- Terminal: iTerm.app
- Version: ~0.2.64~ 0.2.90
- Feedback ID: c894889d-5428-4a45-a009-98e0416db4c0
Errors
[{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1045:899)\n at async pj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:4936)\n at async M31 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:3472)\n at async xj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2742)\n at async jS1 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2676)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:1944)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async m6 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1615:1669)","timestamp":"2025-04-07T10:44:35.353Z"},{"error":"Error: Request was aborted.\n at Tm._createMessage (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:543:24058)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-04-07T10:44:36.809Z"},{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1045:899)\n at async pj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:4936)\n at async M31 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:3472)\n at async xj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2742)\n at async jS1 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2676)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:1944)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async m6 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1615:1669)","timestamp":"2025-04-07T10:44:59.087Z"},{"error":"Error: ENOENT: no such file or directory, stat '/Users/chadfurman/FOSSA/~/.aws/config'\n at statSync (node:fs:1737:25)\n at file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1045:1078\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-04-07T10:45:02.564Z"},{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1045:899)\n at async pj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:4936)\n at async M31 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:3472)\n at async xj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2742)\n at async jS1 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2676)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:1944)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)\n at async Qh (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2318)","timestamp":"2025-04-07T10:45:15.928Z"},{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1045:899)\n at runNextTicks (node:internal/process/task_queues:65:5)\n at process.processTimers (node:internal/timers:546:9)\n at async pj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:4936)\n at async M31 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:3472)\n at async xj5 (file:///Users/chadfurman/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1413:2742)\n at asy
Note: Error logs were truncated.
9 Comments
I would say that "dd" deleting the whole message is especially confusing because the "home" key takes me to the beginning of the line correctly (not the start of the message)
What's happening here is that we're deleting the "logical" line which is not the same as the visual line in your prompt input. The prompt input line wraps around automatically depending on the width of your terminal.
A "new line" is only created when you hit "shift+enter" (if you're on iterm2 and have run
/terminal-setupsuccessfully) or option-enter if you're on apple terminal.I don't think deleting a "visual line" is quite right in this scenario, "logical" line seems to be the right boundary
imho it feels like whatever the decision, Normal Mode -> "I" or "A" (capitol) should match. Right now, "I" or "A" takes you to the start/end of a visual line, but "dd" deletes the logical line.
This would be significantly less annoying if we could just "p" or "P" the line back into place
I would say even that this is triple-confusing. Hitting "j" and "k" move up/down between the visual line which reinforces the fact that this is indeed a separate line we are on, but then DD removes the logical line.
Current Claude Version:
And actually even more confusing / worse is when I am on the last line of a multiple logical line message, then I go "up" a line and I hit "dd", it deletes the wrong line! I'm going to try and reproduce that...
Queue'd up message to send to claude (using enter while claude was working and typing, then repeating for each line):
Then on the last line, going "up" to the "And let's remove the deprecated lines from the husky file also please" and hitting "dd" removes the "I think the github actions..." line instead!
This is very easy to reproduce:
Also, note that the arrow keys don't seem to work in normal mode (only in insert mode)
Note also that "d$" and "d^" operate on the visual line
Thanks for the reports, these are super helpful. We'll look into this soon
This should be fixed in the next release!
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.