Drive interactive CLI tools needing a real terminal (vim, git rebase -i, REPLs) via detached tmux send-keys/capture-pane.
Resources
2Install
npx skillscat add mistakeknot/clavain/using-tmux-for-interactive-commands Install via the SkillsCat registry.
SKILL.md
Using tmux for Interactive Commands
Interactive CLI tools (vim, REPLs, interactive git, etc.) require a real terminal — use tmux detached sessions controlled via send-keys/capture-pane.
When to use
Use: vim/nano, REPLs (Python, Node), git rebase -i, git add -p, full-screen TUIs, readline-dependent commands.
Don't use: non-interactive commands, commands accepting stdin redirection.
Quick Reference
| Task | Command |
|---|---|
| Start | tmux new-session -d -s <name> <cmd> |
| Send input | tmux send-keys -t <name> 'text' Enter |
| Capture | tmux capture-pane -t <name> -p |
| Stop | tmux kill-session -t <name> |
Core Pattern
tmux new-session -d -s edit vim file.txt
sleep 0.3 # wait for init
tmux send-keys -t edit 'i' 'Hello World' Escape ':wq' Enter
tmux capture-pane -t edit -p
tmux kill-session -t editSpecial Keys
Enter, Escape, C-c, C-x, Up, Down, Left, Right, Space, BSpace
With working directory
tmux new-session -d -s rebase -c /repo/path git rebase -i HEAD~3Common Patterns
Python REPL:
tmux new-session -d -s py python3 -i
tmux send-keys -t py 'import math' Enter
tmux send-keys -t py 'print(math.pi)' Enter
tmux capture-pane -t py -p
tmux kill-session -t pyInteractive git rebase:
tmux new-session -d -s rebase -c /repo git rebase -i HEAD~3
sleep 0.5
tmux capture-pane -t rebase -p
tmux send-keys -t rebase ':wq' EnterGotchas
- Blank capture: Add
sleep 0.3afternew-sessionbefore first capture - Command not executed: Must send
Enterexplicitly as a separate argument - Wrong key names: Use
Enternot\n;Escapenot\e - Orphaned sessions: Always
tmux kill-session -t <name>when done