Overview
Keyword highlighting automatically colorizes patterns in terminal output (errors, warnings, IP addresses, etc.) to help you quickly identify important information. Netcatty uses xterm.js decorations for zero-performance-impact highlighting.How It Works
Keyword highlighting operates on visible terminal content:- Pattern Matching: Regular expressions are matched against each line
- Lazy Highlighting: Only visible viewport is processed (debounced)
- Decorations API: Colors are applied as overlays without modifying data
- Auto-disabled in Alternate Buffer: Disabled in vim/htop for performance
Highlighting is purely visual - it doesn’t affect terminal data or command execution.
Highlight Rules
Each rule defines patterns to match and the color to apply.Rule Structure
Example Rule
[error]or[err]in brackets- The word “error” (whole word)
- “fail” or “failed”
- “fatal”, “critical”, “exception”
Default Highlight Rules
Netcatty includes 6 default rules covering common patterns.- Error
- Warning
- Success/OK
- Info
- Debug
- IP & MAC Addresses
Color: Red (#F87171)Patterns:
\[error\],\[err\]\berror\b,\bfail(ed)?\b\bfatal\b,\bcritical\b\bexception\b
ERROR: File not found[error] Connection failedfatal: not a git repository
Global Configuration
Configure highlighting for all terminals.Enabling/Disabling
Master toggle for keyword highlighting
- Navigate to Settings → Terminal
- Scroll to Keyword Highlighting section
- Toggle Enable Keyword Highlighting
Managing Rules
UI Workflow:- Settings → Terminal → Keyword Highlighting
- View list of rules with:
- Label and preview color
- Enable/disable toggle
- Pattern count
- Click a rule to edit
- Use + Add Rule to create new
Creating Rules
Steps:- Click + Add Rule
- Configure:
- Label: Descriptive name
- Color: Click to open color picker
- Patterns: Add regex patterns (one per line)
- Enabled: Toggle on
- Test against sample output
- Click Save
Editing Rules
- Click on existing rule
- Modify:
- Label
- Color (click swatch to change)
- Patterns (add/remove/edit)
- Click Update
Rule Priority
When multiple rules match the same text:- First match wins (rule order matters)
- Reorder rules by dragging in the UI
- More specific patterns should come before general ones
Host-Specific Highlighting
Override global rules per host.Configuration
Enable highlighting for this host (overrides global setting)
Custom rules for this host (extends or replaces global rules)
Example
UI Workflow
- Open Host Details panel
- Navigate to Advanced → Keyword Highlighting
- Click Customize Highlights
- Options:
- Use Global Rules: Inherit from settings
- Extend Global Rules: Add host-specific rules
- Replace Global Rules: Use only host rules
- Add/edit/remove rules
- Click Save
Use Cases
Application-Specific Logs
Application-Specific Logs
Highlight patterns unique to an application:
- NGINX/Apache log levels
- Application error codes
- Custom status messages
Server Type Indicators
Server Type Indicators
Different colors for different server roles:
- Production: Red for errors
- Staging: Yellow for warnings
- Development: Blue for info
Network Equipment
Network Equipment
Highlight switch/router output:
- Interface states (up/down)
- VLAN IDs
- MAC addresses
- Protocol names (BGP, OSPF, etc.)
Writing Regex Patterns
Pattern Syntax
Patterns are JavaScript regular expressions withgi flags (global, case-insensitive).
Common Patterns:
- Exact Match
- Word Boundary
- Brackets
- Optional Text
- Alternatives
- IP Address
Match exact strings:Matches:
ERROR, error, ErrorPattern Examples
HTTP Status Codes:Testing Patterns
Use the Test Pattern feature in the rule editor:- Enter your pattern
- Paste sample terminal output
- Netcatty shows matches highlighted
- Adjust pattern as needed
Performance Considerations
Netcatty optimizes highlighting for smooth terminal operation.Optimizations
Milliseconds to wait before highlighting after scroll/write
- Terminal content changes (scroll or new output)
- Netcatty waits 150ms for more changes
- If no changes, highlights the visible viewport
- Result: Smooth scrolling with no lag
Best Practices
Pattern Efficiency
Pattern Efficiency
- Specific patterns:
\[error\]is faster thanerror - Anchor patterns: Use
\bfor word boundaries - Avoid greedy quantifiers:
.*can be slow
Rule Count
Rule Count
- Keep rules under 20 for best performance
- Combine similar patterns into one rule
- Disable unused rules
Alternate Buffer
Alternate Buffer
Highlighting auto-disables in alternate buffer (vim, htop, etc.) to avoid impacting interactive applications.
Use Cases
System Administration
Log Monitoring:Development
Build Output:Network Operations
Switch Configuration:Troubleshooting
Pattern Not Matching
Pattern Not Matching
Possible Causes:
- Regex syntax error
- Case-sensitivity (patterns are case-insensitive by default)
- Need to escape special characters
- Test pattern in rule editor
- Check regex syntax: regex101.com
- Escape special chars:
[ ] ( ) . * + ? ^ $ \ |
Highlighting Not Appearing
Highlighting Not Appearing
Possible Causes:
- Highlighting disabled globally or for host
- Rule is disabled
- In alternate buffer (vim/htop)
- Check Settings → Terminal → Keyword Highlighting is ON
- Verify rule is enabled (green toggle)
- Exit vim/htop and check normal terminal
Performance Issues
Performance Issues
Possible Causes:
- Too many rules
- Complex regex patterns
- Very long terminal lines
- Reduce number of active rules
- Simplify patterns (avoid
.*) - Disable highlighting temporarily if needed
Wrong Color Appearing
Wrong Color Appearing
Cause: Multiple rules matching, wrong prioritySolution:
- Reorder rules (more specific first)
- Make patterns more specific
- Check for overlapping patterns
Advanced Examples
Multi-Pattern Rules
Combine multiple related patterns:Contextual Highlighting
Highlight based on context:Time-Based Patterns
Highlight timestamps:Related Resources
Custom Themes
Create terminal color schemes
Host Configuration
Apply highlighting per host
Terminal Settings
Configure terminal appearance and behavior
