SendTmux
A powerful VS Code extension that allows you to send selected code or text directly from the editor to a Tmux terminal pane. Perfect for REPL-driven development, interactive programming, and quickly testing code snippets. ✨ Key Features
📦 RequirementsTmux InstallationThis extension requires Tmux to be installed on your system:
Verify installation:
🚀 Quick Start1. Basic Workflow
2. Usage ExamplesPython REPL Development:
Shell Script Execution:
Node.js Interactive Development:
📋 Command ListThe extension provides the following commands (accessible via Command Palette 1. SendTmux: Send Selection to Tmux
2. SendTmux: Send Selection with Confirmation
3. SendTmux: Select Tmux Target
⚙️ Configuration OptionsConfigure the following options in VS Code settings ( Basic Configuration
|
| Format | Example | Description |
|---|---|---|
session |
dev |
Sends to the current pane of the entire session |
session:window |
dev:0 |
Sends to a specific window of a specific session |
session:window.pane |
dev:0.1 |
Sends to a specific pane of a specific window and session |
📝 Configuration Examples
Example 1: Set Default Target
Suitable for fixed workflows where you always send to the same pane:
{
"sendtmux.session": "dev",
"sendtmux.window": "0",
"sendtmux.pane": "1",
"sendtmux.appendNewline": true
}
Example 2: Python REPL Configuration
Line-by-line sending, perfect for interactive programming:
{
"sendtmux.session": "python-repl",
"sendtmux.sendMode": "line-by-line",
"sendtmux.appendNewline": true,
"sendtmux.rememberTarget": true
}
Example 3: Safe Mode Configuration
Always confirm before sending to prevent accidental operations:
{
"sendtmux.confirmBeforeSend": true,
"sendtmux.rememberTarget": true
}
Example 4: Workspace Specific Configuration
Configure for a specific project in .vscode/settings.json:
{
"sendtmux.session": "my-project",
"sendtmux.window": "backend",
"sendtmux.pane": "0",
"sendtmux.sendMode": "all-at-once"
}
⌨️ Custom Keybindings
Customize keybindings in keybindings.json:
Example Keybindings
[
{
"key": "ctrl+enter",
"mac": "cmd+enter",
"command": "sendtmux.sendSelection",
"when": "editorTextFocus && editorHasSelection"
},
{
"key": "ctrl+shift+enter",
"mac": "cmd+shift+enter",
"command": "sendtmux.sendWithConfirmation",
"when": "editorTextFocus && editorHasSelection"
},
{
"key": "ctrl+alt+t",
"mac": "cmd+alt+t",
"command": "sendtmux.selectTarget"
}
]
🎬 Use Cases
Case 1: Python Data Analysis
# 1. Start Tmux and IPython
tmux new -s data-analysis
ipython
# 2. Write and test code in VS Code
import pandas as pd
import numpy as np
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
df.describe() # Select and send
Case 2: Shell Script Debugging
# Execute script parts step-by-step
cd /var/log
tail -f syslog # Select and send
grep "error" syslog | head -10 # Select and send
Case 3: Node.js Development
// Send to Node REPL for quick testing
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello World!');
});
Case 4: Multi-service Development
Run different services in different Tmux panes:
- Pane 0: Database
- Pane 1: Backend API
- Pane 2: Frontend dev server
- Pane 3: Log monitoring
Send commands to different panes via the extension.
🔧 Advanced Features
Interactive Target Selection
When you execute the send command, the extension shows a smart selection menu:
- Recent Targets - Shows history for quick selection
- Available Sessions - Lists all running Tmux sessions
- Custom Target - Manually input a target string
- Step-by-step Selection - Select session first, then window, then pane
Target Validation
Automatically validates before sending:
- ✅ Is Tmux installed
- ✅ Does the target session exist
- ✅ Are the target window and pane valid
- ❌ Shows error message if target is not found
Error Handling
- Tmux not installed: Shows installation guide
- No text selected: Friendly reminder
- Target not found: Shows target string and suggestions
- Command execution failure: Shows detailed error information
🐛 Known Issues
None at the moment. Please submit an Issue on GitHub if you encounter any.
📜 Changelog
0.0.1 (Initial Release)
Initial version released with:
- ✅ Send selected text to Tmux pane
- ✅ Smart target selection system
- ✅ History (up to 10 entries)
- ✅ Two send modes (all-at-once/line-by-line)
- ✅ Complete error handling and validation
- ✅ Rich configuration options
- ✅ Custom keybindings support
- ✅ Workspace configuration support
🤝 Contributing
Contributions, bug reports, and feature requests are welcome!
📄 License
MIT License
🙏 Acknowledgements
Thanks to all developers for using and supporting this project!
Enjoy a highly efficient Tmux integrated development experience! 🚀