History Autocomplete
Start your input with ! and Claude Code enters bash mode: what you type runs directly in your shell, its output lands in the conversation, and Claude responds to it. The commands you run there tend to repeat — the same test invocation, the same git log flags, the same deploy check — and bash mode remembers them. Press Tab partway through a command and Claude Code completes it from the ! commands you've run before in this project.
Add live file-path suggestions on top, and the ! prompt starts to feel like a small, project-aware shell of its own.
Completing From Your ! History
- Type
!— the prompt switches to bash mode. - Type the start of a command you've run before:
! npm run test: - A gray ghost-text suggestion from your earlier
!commands appears at the cursor. Press Tab to accept it. - Edit if needed, then press Enter to run.
The history is your Claude Code ! history for the current project — not your system-wide shell history, so suggestions are always commands that made sense in this repo. A command you just ran shows up as a suggestion straight away.
This is separate from shell-style ! history expansion (!!, !$), which is off by default.
Completing File Paths
Bash mode also completes paths live. Type a token containing a forward slash — ./src/, ~/, ../config/ — and a dropdown of matching files and directories appears; press Tab to accept and keep going:
! wc -l ./src/logic/ # dropdown shows the files in src/logic/
Use forward slashes on Windows too: the dropdown is triggered by /, not \.
Getting In and Out Quickly
| Action | Keys |
|---|---|
| Enter bash mode | Type ! at the start, or paste text that begins with ! into an empty prompt |
| Leave bash mode | Esc, Backspace, or Ctrl+U on an empty prompt |
| Background a slow command | Ctrl+B while it runs |
| Recall a full earlier prompt instead | Up, or Ctrl+R to search |
By default Claude replies to each command's output automatically. If you'd rather run several commands and then ask about them together, set "respondToBashCommands": false in settings.json.
Pro tip: Run your project's longer incantations through ! once — the full test command with its flags, the log query with its filters — and from then on they're two letters and a Tab away, in exactly the project where they belong.
Try It Now
- Run a command you use often:
! git log --oneline -10 - Notice the output arrives and Claude comments on it.
- Type
! git land watch the ghost text offer the rest; press Tab, then Enter. - Type
! ls ./and pick a directory from the path dropdown with Tab.
Related Features
- ! Bash Mode — Everything else about running shell commands from the prompt
- Tab completion — The same Tab habit for
@file mentions and slash commands - Ctrl+R — Search your full prompt history interactively
- Ctrl+B — Background long-running
!commands to keep working - Queue messages —
!commands typed while Claude works wait their turn