[BUG] Tab completion broken for ! prefix bash commands
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Tab completion no longer works when typing bash commands with the ! prefix. When I press Tab while typing a command or path after !, nothing happens. Previously, Tab would complete command names and file paths.
What Should Happen?
Pressing Tab after ! should complete shell commands and file paths, like it did in previous versions.
Steps to Reproduce
- Start Claude Code
- Type
!npm in(partial command) - Press Tab
- Observe: No completion happens
- Expected: Should complete to
!npm install
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Not certain of exact version, but worked before Tab was repurposed from "Toggle Thinking mode" to completing suggested prompts.
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Tab completion for !-prefixed input is contextually distinct from suggested prompt completion. When input starts with !, we're in "bash mode" and Tab should complete shell commands/paths. These two uses don't conflict, so both could work based on context.
Showing cached comments. Read the full discussion on GitHub ↗
20 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
+1 Additionally, it would be good to follow the zsh or bash setup for auto completion
any update?
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.
Still needed.
Still needed.
Still needed.
Seeing a lot of duplicates of this issue which seem to point at one another in a loop. All of them are closed 🤷♂️. While the issue is there.
Still needed, hope this is the right Issue to comment as there are many duplicates pointing at each other in a loop and closed.
Small things matter :)
Still needed. It avoids interleaving b/w cc and terminal.
+1
Still needed. Following.
+1
+1
+1 still needed
+1 still needed
+1 still needed
+1 still needed
+1
Still reproducing on 2.1.217 (macOS, iTerm2, zsh) — and it's broader than just command names.
File paths don't complete either. #71458 states that v2.1.193 added live file path autocomplete to bash mode, but on 2.1.217:
run in a directory containing both
CLAUDE.mdandCLAUDE.local.md. No expansion, no menu, no-op. So either that shipped and regressed, or it never covered this case — worth confirming, since the docs issue is being tracked on the assumption it works.Command names — the original repro is unchanged:
!npm in+ Tab completes nothing unlessnpm installis already in this project's!history. History-based completion only helps after you've typed a command in full at least once, which is backwards from how every shell behaves.Concrete cost: I drive a Raspberry Pi over SSH from Claude Code, running things like
!scp teslausb.local:/mutable/TeslaCam/SentryClips/<long path> ~/Movies/TeslaCam/. With neither path nor command completion, those get typed by hand or I drop to a real terminal and lose the session context — exactly the interleaving another commenter mentions above.Not asking for full zsh compsys integration (that's #7738). Local path completion plus
$PATHbinary names would remove most of the friction.