Clipboard Mode Guide
Universal editor support via clipboard operations - works with any editor without extensions.
Overviewβ
Clipboard mode provides a fallback integration method that works with any editor through simple copy/paste operations. It's ideal when:
- Your editor doesn't have a Radium extension
- You want a lightweight integration
- You need cross-editor compatibility
- Extension installation is not possible
How It Worksβ
- Copy code with optional file path annotation
- Run
rad clipboard sendto process with Radium - Copy result from output
- Paste back into your editor
Installationβ
No installation required! Just ensure Radium CLI is in your PATH:
rad --version # Verify CLI is installed
Usageβ
Sending Code to Radiumβ
Step 1: Copy Code with Annotation (Optional)β
Add a file path annotation to your code when copying:
For C-style languages (Rust, C, Java, JavaScript, etc.):
// File: src/main.rs
fn main() {
println!("Hello, world!");
}
For hash-comment languages (Python, Ruby, Shell, YAML, etc.):
# File: main.py
def main():
print("Hello, world!")
For HTML/XML:
<!-- File: index.html -->
<html>
<body>Hello</body>
</html>
Step 2: Send to Radiumβ
rad clipboard send
This will:
- Read from clipboard
- Parse file path and language (if annotated)
- Detect language automatically (if not annotated)
- Prepare context for Radium processing
Output:
rad clipboard send
β’ Reading from clipboard...
β Content parsed
File path: src/main.rs
Language: rust
β’ Sending to Radium...
Context:
{
"file_path": "src/main.rs",
"language": "rust",
"selection": "fn main() {\n println!(\"Hello, world!\");\n}",
"surrounding_lines": ""
}
β Processed code from clipboard and prepared for Radium.
Use 'rad step <agent-id>' with this context to process the code.
Receiving Code from Radiumβ
rad clipboard receive
Formats the last agent output and writes to clipboard with file path annotation for easy pasting.
Language Detectionβ
If no file path annotation is provided, Radium attempts to detect language from:
- Shebang (
#!/usr/bin/env python3) - Code patterns:
fn main()β Rustdef+importβ Pythonfunction+=>β JavaScriptpackage+funcβ Go
File Path Annotation Formatβ
The annotation format supports several comment styles:
| Language Type | Format | Example |
|---|---|---|
| C-style | // File: path | // File: src/main.rs |
| Hash | # File: path | # File: main.py |
| HTML/XML | <!-- File: path --> | <!-- File: index.html --> |
Notes:
- Annotation must be on the first line of copied content
- Path can be relative or absolute
- Language is auto-detected from file extension if path provided
Workflow Examplesβ
Example 1: Quick Refactorβ
-
Copy code with annotation:
// File: utils.rs
pub fn old_name() {} -
Send to Radium:
rad clipboard send
rad step refactor-agent "Rename function to new_name" -
Copy result from Radium output
-
Paste into editor
Example 2: Multi-file Contextβ
- Copy code from multiple files sequentially
- Each copy includes file annotation
- Send each to Radium with context
Example 3: Any Editor Workflowβ
-
In Vim/Emacs/Any Editor:
- Select code
- Copy with annotation comment
-
Terminal:
rad clipboard send
rad step code-agent "Add error handling" -
Back in Editor:
- Copy result from terminal
- Paste into file
Integration with rad stepβ
Clipboard mode works seamlessly with rad step:
# Read from clipboard and process
rad clipboard send | rad step code-agent
# Or process with specific context
rad step code-agent --context "$(rad clipboard send)"
Limitationsβ
- No automatic context injection (must annotate manually)
- No diff preview (compare manually)
- No chat integration (use
rad chatseparately) - Manual copy/paste required
Tipsβ
- Create Editor Macros: Set up keyboard shortcuts in your editor to add file path annotations automatically
- Use Aliases: Create shell aliases for common workflows
alias rad-copy='rad clipboard send | rad step code-agent' - Template Comments: Keep annotation templates in a snippet/abbreviation system
Troubleshootingβ
Clipboard Emptyβ
Issue: "Clipboard is empty" error
Solution:
- Ensure code is copied before running command
- Test clipboard access:
rad clipboard send(should show content) - Check system clipboard permissions
Language Not Detectedβ
Issue: Language shows as "unknown"
Solution:
- Add file path annotation with extension
- Use explicit language hints in annotation
- Check code patterns match known languages
File Path Not Parsedβ
Issue: File path annotation not recognized
Solution:
- Ensure annotation is on first line
- Use correct comment style for language
- Format:
// File: pathor# File: pathor<!-- File: path -->
See Alsoβ
- Overview - Comparison of integration methods
- Architecture - Technical details
- Troubleshooting - Common issues