A tmux plugin that opens a floating popup to interact with Claude LLM. Supports two interaction modes (command generation and Q&A) with an interactive response viewer. Responses can be automatically sent to the tmux pane that triggered the popup.
prefix + l
- π Floating popup at the bottom of the screen (normal mode) or centered (zoom mode)
- π€ Integration with Claude API (Anthropic)
- π― Two interaction modes:
- Command mode: Generate executable shell commands (default)
- Ask mode: Get explanations and answers (prefix with
?)
- β¨οΈ Automatic response injection into the active pane
- π Copy responses to clipboard
- π Interactive response viewer with markdown support
- βοΈ Configurable key binding and model selection
- π Secure API key handling via environment variable or tmux option
- π¨ Enhanced UI with
gumandglow(optional, falls back gracefully) - Write Anywhere: This plugin can insert text at any cursor position in your active editor.
- tmux 3.0 or higher (for
display-popupsupport) curlcommand-line tooljqfor JSON processing- Claude API key from Anthropic
- Optional but recommended:
gumfor enhanced UI andglowfor markdown rendering
- Clone or download this repository:
cd ~/.tmux/plugins
git clone <your-repo-url> tmux-llm-assistant
# OR if you have it locally:
cp -r /path/to/tmux-llm-assistant ~/.tmux/plugins/- Make scripts executable:
chmod +x ~/.tmux/plugins/tmux-llm-assistant/llm-assistant.tmux
chmod +x ~/.tmux/plugins/tmux-llm-assistant/scripts/*.sh- Add to your
~/.tmux.conf:
# Load the plugin
run-shell ~/.tmux/plugins/tmux-llm-assistant/llm-assistant.tmux- Reload tmux configuration:
tmux source-file ~/.tmux.confIf you use TPM, add this to your ~/.tmux.conf:
set -g @plugin 'your-username/tmux-llm-assistant'Then press prefix + I to install.
Option A: Environment Variable (Recommended)
export CLAUDE_API_KEY="your-api-key-here"Add this to your ~/.bashrc, ~/.zshrc, or shell profile to make it persistent.
Option B: Tmux Option
tmux set-option -g @llm-assistant-api-key "your-api-key-here"Add this to your ~/.tmux.conf to make it persistent.
Default key binding is prefix + l (normal) and prefix + L (zoom). To change it:
tmux set-option -g @llm-assistant-key "a" # Use prefix + a (normal) and prefix + A (zoom)Add to ~/.tmux.conf to make it persistent.
Default model is claude-opus-4-5-20251101. To use a different model:
tmux set-option -g @llm-assistant-model "claude-opus-4-5-20251101"- Normal mode: Press
prefix + l(or your custom key binding)- Small popup at the bottom of the screen (80% width, 15% height)
- Zoom mode: Press
prefix + L(orprefix + <uppercase-key>)- Large centered popup (90% width, 85% height) for longer interactions
The plugin supports two modes based on your input prefix:
-
Command Mode (default): Generate executable shell commands
> find all files modified in the last 7 daysResponse will be sent directly to your pane and executed.
-
Ask Mode: Get explanations and answers (prefix with
?)> ? what is the difference between git merge and git rebase?Response is displayed with markdown formatting.
After Claude responds, you'll see an interactive viewer using less pager:
Navigation in the response viewer:
- Use arrow keys, Page Up/Down, or vim keys (
j/k,Space/b) to scroll through the response - The response is displayed with markdown formatting (if
glowis installed) or plain text
Action keys (shown at bottom of viewer):
- [Enter]: Execute/send the response to your pane (command mode only)
- [c]: Copy response to clipboard
- [q]: Go back to input stage to ask another question
- [Esc]: Exit the popup completely
- Press
Ctrl+CorEscto cancel at any time - Leave input empty and press Enter to exit
> find all files modified in the last 7 days
> ? explain what this bash script does: [paste your code]
> ? what is the difference between git merge and git rebase?
- Make sure you've set the API key using one of the methods above
- Verify the key is accessible:
echo $CLAUDE_API_KEY - Check tmux option:
tmux show-option -gqv "@llm-assistant-api-key"
- Check your internet connection
- Verify curl is working:
curl -I https://api.anthropic.com - Check firewall/proxy settings
- HTTP 401: Invalid API key - verify your key is correct
- HTTP 429: Rate limit exceeded - wait and try again
- HTTP 400: Invalid request - check if model name is correct
- Check Claude API status: https://status.anthropic.com/
- Verify your API key has the correct permissions and credits
- Ensure you're using tmux 3.0+
- Verify the plugin is loaded:
tmux list-keys | grep llm - Check that scripts are executable:
chmod +x scripts/*.sh
- Check if the target pane is still active
- Note: Only command mode responses are sent to the pane automatically
- Install
jq:brew install jq(macOS) orapt-get install jq(Linux)
- Install
gumfor better UI:brew install gum(macOS) or see gum installation - Install
glowfor markdown rendering:brew install glow(macOS) or see glow installation - The plugin works without these, but with a simpler interface
tmux-llm-assistant/
βββ llm-assistant.tmux # Main plugin file
βββ scripts/
β βββ llm-popup.sh # Popup handler script
β βββ claude-api.sh # Claude API integration
βββ README.md
- Never commit your API key to version control
- Use environment variables for API keys when possible
- The API key is passed as a command-line argument (visible in process list)
- Temporary files are created in
/tmp/and cleaned up automatically
Use prefix + L to open a larger, centered popup ideal for longer interactions.
The plugin automatically detects and uses: pbcopy (macOS), xclip/xsel (Linux), or tmux buffer as fallback.
MIT License - feel free to modify and distribute.
This project was fully vibe coded. π¨
Contributions welcome! Please feel free to submit a Pull Request.