The ck TUI provides an interactive search interface with real-time results, multiple preview modes, and keyboard-driven navigation.
# Launch TUI in current directory
ck --tui
# Launch with initial query
ck --tui "error handling"
# Launch in specific directory
ck --tui --path /path/to/code| Key | Action |
|---|---|
↑ / ↓ |
Navigate through search results |
PageUp / PageDown |
Scroll preview (in full-file mode) |
Enter |
Open selected file(s) in $EDITOR |
Ctrl+Up / Ctrl+Down |
Navigate search history |
| Key | Action |
|---|---|
Tab |
Cycle search modes (Semantic → Regex → Hybrid) |
| Type any text | Update search query (300ms debounce) |
Backspace |
Delete character from query |
/command |
Enter command mode (see Commands below) |
| Key | Action |
|---|---|
Ctrl+V |
Cycle preview modes (Heatmap → Syntax → Chunks) |
Ctrl+F |
Toggle snippet/full-file view |
Ctrl+D |
Show chunk metadata for current file |
| Key | Action |
|---|---|
Ctrl+Space |
Toggle selection of current file |
Enter |
Open all selected files (or current if none selected) |
| Key | Action |
|---|---|
q or Esc |
Quit TUI |
Ctrl+C |
Force quit |
Finds code by meaning using embeddings. Best for conceptual queries:
"error handling"
"database connection pooling"
"user authentication"
Traditional pattern matching for exact text searches:
"TODO|FIXME"
"function.*Error"
"\bauth\b"
Combines semantic understanding with keyword precision using Reciprocal Rank Fusion:
"async timeout"
"cache invalidation"
Shows semantic similarity with color-coded highlighting:
- Red: Lower similarity (0.6-0.7)
- Yellow: Medium similarity (0.7-0.85)
- Green: High similarity (0.85+)
Displays syntax-highlighted code using your file's language:
- Powered by
syntectfor accurate highlighting - Supports 7+ languages plus text formats
Shows chunk boundaries and metadata:
- Visual indicators for chunk start/end
- Chunk type annotations (Function, Class, Method)
- Useful for understanding how code is indexed
Shows ±5 lines of context around matches. Perfect for quick scanning of results.
Press Ctrl+F to toggle. Features:
- Scrollable full file content
- Auto-scrolls to matched line when navigating results
PageUp/PageDownfor navigation- Matched line stays highlighted
Start your query with / to enter command mode:
/open <filename> - Open specific file
/config - Show current configuration
/help - Show help message
- Navigate to a file you want to open (
↑/↓) - Press
Ctrl+Spaceto select it - Continue selecting additional files
- Press
Enterto open all selected files
Selected files are shown with a [✓] indicator in the results list.
The TUI opens files in your $EDITOR (or $VISUAL) with line numbers. Supported editors:
| Editor | Support | Format |
|---|---|---|
| Vim/Neovim | ✅ Full | Opens in tabs with line numbers |
| VS Code | ✅ Full | -g file:line format |
| Cursor | ✅ Full | -g file:line format |
| Sublime | ✅ Full | file:line format |
| Emacs | ✅ Limited | Opens first file only |
| Nano | ✅ Limited | Opens first file only |
Set your editor:
export EDITOR=vim
export EDITOR=code
export EDITOR=cursorThe TUI shows detailed progress during indexing:
Indexing repository for semantic search...
src/main.rs • 23/145 files • 5/12 chunks
[████████████░░░░░░░░] 67%
- File name: Currently processing file
- File progress: Completed/total files
- Chunk progress: Completed/total chunks in current file
- Progress bar: Overall completion percentage
TUI preferences are automatically saved to:
- Linux/macOS:
~/.config/ck/tui.json - Windows:
%APPDATA%\ck\tui.json
Saved settings:
- Last used search mode
- Preview mode preference
- Full-file mode setting
The TUI maintains a history of your last 20 searches:
- Navigate with
Ctrl+Up/Ctrl+Down - History persists across searches within same session
- Duplicate queries are not added
- First search: May take longer as index is built
- Subsequent searches: Near-instant using cached index
- Large codebases: Use specific query terms to reduce result set
- Snippet mode: Faster rendering than full-file mode
- Ensure terminal supports colors:
echo $TERM - Check terminal size:
stty size(minimum 80x24)
- Verify
$EDITORis set:echo $EDITOR - Ensure editor is in
$PATH
- Check search mode (Tab to cycle)
- Try broader query terms
- Verify files are indexed:
ck --status .
- First search builds index (one-time cost)
- Large result sets: Add threshold with
--threshold 0.7 - Check index size:
du -sh .ck/
ck --tui "authentication"
# Press Tab to cycle to Regex mode
# Type: "login|auth|credentials"ck --tui "error handling"
# Use Ctrl+Space to select multiple files
# Press Enter to open all in editorck --tui "database"
# Press Ctrl+V to switch to Chunks mode
# Press Ctrl+F for full-file view
# Use PageDown to exploreThe TUI is implemented in the ck-tui crate:
- app.rs (988 lines): Main event loop and state management
- preview.rs (658 lines): Preview rendering (heatmap, syntax, chunks)
- chunks.rs (428 lines): Chunk display and metadata
- commands.rs (408 lines): Command mode execution
- rendering.rs (210 lines): UI component rendering
- state.rs (45 lines): Application state
- config.rs (90 lines): Configuration persistence
Built with ratatui and crossterm.
The TUI is under active development. Contributions welcome for:
- Additional preview modes
- Custom keyboard shortcuts
- Theme/color customization
- Performance optimizations
See CONTRIBUTING.md for development setup.