A shell widget that generates bash commands from natural language using Claude.
bashguy_with_bgm.mp4
Type what you want to do in plain English, and Claude generates the command and inserts it into your command line. If there's already partial input, it inserts a completion at the cursor position.
- Claude Code CLI (
claudecommand) - Bash
Add the following to your .bashrc:
source /path/to/bashguy.shNo key binding is set by default. Add a bind command after sourcing the script in your .bashrc:
source /path/to/bashguy.sh
bind -x '"\C-g": _bashguy_widget'| Key | bind command |
|---|---|
| Ctrl+G | bind -x '"\C-g": _bashguy_widget' |
| Ctrl+J | bind -x '"\C-j": _bashguy_widget' |
| Ctrl+X Ctrl+G | bind -x '"\C-x\C-g": _bashguy_widget' |
- Press your bound key to get a
[bashguy]prompt - Describe what you want to do (e.g.,
count the number of files in the current directory) - Claude generates the command and inserts it into your command line
If you press the key with partial input on the command line, it inserts a completion at the cursor position.
Set the BASHGUY_MODEL environment variable to use a different model. The default is claude-sonnet-4-20250514.
export BASHGUY_MODEL=claude-haiku-4-5-20251001MIT
Yasuhiro Matsumoto (a.k.a. mattn)