Implement more Vim motions and shortcuts (`f`, `t` etc)

Status Closed — not planned
Maintainer reply None cached
Activity 9 comments · opened May 21, 2025 · closed Jan 14, 2026

Claude Code is currently missing some very useful Vim movements and other Vim shortcuts. Everyone has their favourites, and you probably can't implement them all.

These ones here would make is significantly faster to move the cursor around:

  • [x] f / F for jumping to next/prev character in a line ✅
  • [x] t / T for jumping to just before next/prev character in a line ✅
  • [x] ; and , to repeat previous f/F movement forward / backward
  • ; and , to repeat previous t/T movement forward / backward
  • [x] (and combined with d / c etc make editing a lot easier)

Some more that would be really useful for editing:

  • [x] ciw ✅, yiw, diw ✅ etc for operating on 'inner word's
  • [x] yanking text with any of the yank motions (Y, yy, yiw, yf{letter}, etc)
  • [x] pasting with p or P in normal mode. Currently it seems you have to enter insert mode to paste with Cmd-V

Some others which would also be handy:

  • [x] u ✅ for undo!
  • [x] >> / << indent current line
  • [x] hJ for joining lines separated by space is handy

Some bugs that I'm aware of that are really annoying:

  • BUG: dw deletes too far, it's not meant to delete the trailing newline character on the line
  • BUG: a at the very end of a line does not work properly. Cursor ends up in the wrong position

Anyway, thanks so much for adding a Vim mode, it's a great feature. Creating and editing prompts is one of the bottlenecks now! The easier it is to do that the better IMO.

----

UPDATE: have been marking off some of these as they have been recently implemented.

View original on GitHub ↗

9 Comments

aaronik · 1 year ago

I'll throw one in:

I just was wrapping up a very long prompt, and went to clear the last couple lines. I used dd and the entire prompt disappeared, and u did not bring it back. It seems to be gone. Very frustrating. I thought it was going to only remove the last lines, because k and j in normal mode jumped up and down lines, rather than having to type gj and gk like in vim. These subtleties matter!

jhojin7 · 1 year ago

+👍 for ci[w|W]

amirhomayoun · 10 months ago

I would appreciate a jj to Escape mapping (maybe that could be customized, or you could read ~/.input.rc and look for vi-movement-mode). That's what I use in vim, and in the terminal command line and is very convenient to go to normal mode instead of pressing the escape key.

Thanks for adding the vim mode btw! Even though it is not covering all the keys and motions it is working well!

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

phamquiluan · 8 months ago

Can we have a v shortcut to turn on visual mode, or open a temporary vim editor to edit the current prompt? Exit that editor would return to the prompt box. I have seen this in some other tools (can't remember the name), and they are super efficient, especially with long prompts where there are multilines and bullets, etc.

--
UPDATE: ctrl-g actually do the job, after I set EDITOR=vim in my ~/.bashrc

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 7 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Upvote or comment on that issue, so maybe it gets noticed.

asgeo1 · 7 months ago

FWIW, most of my original list of vim motions have been implemented now.

How it handles newline characters is currently my biggest gripe, frustrating when it removes newlines characters when it shouldn't or positions the cursor on the wrong line etc.

But overall, it's much easier to work with now. Plus I <ctrl>+g a lot now to use a full vim instance, mostly so I don't accidentally submit my prompt when typing out a lot of info.

github-actions[bot] · 7 months ago

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.