Preview Pane¶
The right pane in Trek continuously previews the selected entry. By default it shows file contents with syntax highlighting. A set of preview modes let you switch the pane to show different information about the same file without navigating away.
Default Preview¶
- Text files — displayed with syntax highlighting
- Directories — show their contents as a listing
- Raster images (PNG, JPEG, GIF, BMP, ICO, WEBP, AVIF, TIFF) — show a metadata card with format, file size, and pixel dimensions. When
chafais installed, Trek also renders an inline image using Unicode block characters or sixels directly in the preview pane. - SVG — previewed as syntax-highlighted XML, the same as any text file
- Binary files — show a placeholder message
Preview Modes¶
Preview modes are toggled by key and are mutually exclusive with each other. Pressing the same key again returns the pane to the default text preview.
| Key | Mode | Description |
|---|---|---|
d |
Diff preview | Shows git diff HEAD -- <file> for the selected file |
m |
Meta card | Shows file metadata: permissions, size, and timestamps. For text files also shows line, word, and character counts. For symlinks shows the target path and whether it resolves. |
V |
Git log preview | Shows git log --oneline -30 -- <path>. Works for directories as well as files — directories show commits that touched any file in the subtree. |
a |
Hex dump | Shows a hex dump via xxd, falling back to hexdump -C if xxd is not available. Files larger than 4 MB show a size-limit message. |
D |
Disk usage | For directories: shows immediate children sorted largest-first with Unicode block bars representing relative size. Pressing D on a file shows an error. |
f |
Compare two files | Select exactly two files with Space, then press f to display a unified diff (diff -u) between them. |
Display Options¶
These toggles apply on top of whichever preview mode is active:
| Key | Option |
|---|---|
# |
Toggle line numbers — adds a dark gray gutter with absolute line numbers |
U |
Toggle word wrap — soft-wraps long lines at the pane boundary; shows a [wrap] indicator in the title |
Preview Focus and Line Selection¶
Pressing → or l on any file in the file tree enters preview focus mode instead of opening an editor. The preview pane border turns cyan to indicate that keyboard input is now captured by the pane.
Navigation¶
| Key | Action |
|---|---|
j / ↓ |
Move cursor down one line |
k / ↑ |
Move cursor up one line |
g |
Jump to first line |
G |
Jump to last line |
[ / ] |
Scroll up / down 5 lines |
The cursor line is highlighted in blue. Use ←, h, or Esc to return focus to the file tree. Press Enter to open the file in $EDITOR.
Selecting lines¶
Press J to extend the selection downward or K to extend it upward. The first press sets an anchor at the current cursor position; subsequent presses grow the range. Selected lines are highlighted in dark gray.
Sending lines to a cmux surface¶
With a cursor position or selection active, press Tab to open the cmux surface picker. The picker shows all surfaces in your current cmux workspace:
╭─ Send to surface ──────────────────────────────────╮
│ Filter: █ │
│ │
│ ▶ >_ surface:3 ✳ Claude Code │
│ >_ surface:7 zsh │
│ [B] surface:1 localhost:3000 │
│ │
│ → "fn handle_event(..." (3 lines) │
│ ↑↓ navigate · Enter send · Esc cancel │
╰─────────────────────────────────────────────────────╯
Type to filter by surface title or type (terminal, browser, markdown). Press Enter to send. After sending, cmux shifts keyboard focus to the target pane so your next keystroke lands there — no manual window switching required.
Typical AI workflow:
- Browse to a file in Trek and press
→to enter preview focus - Navigate to the relevant section with
j/k - Press
JorKto select the lines you want to share as context - Press
Tab, pick your Claude Code session, pressEnter - Start typing your question immediately — focus is already in the Claude session
Scrolling the Preview¶
| Key | Action |
|---|---|
[ |
Scroll up 5 lines |
] |
Scroll down 5 lines |
| Mouse scroll wheel | Scroll 3 lines per event |
Scrolling works in all preview modes.
Preview Pane Title Indicators¶
The preview pane title bar shows a badge identifying the active mode or display option:
| Badge | Meaning |
|---|---|
[diff] |
Git diff mode active |
[meta] |
Metadata view active |
[log] |
Git log mode active |
[hex] |
Hex dump mode active |
[du] |
Disk usage mode active |
[compare] |
Two-file compare active |
[wrap] |
Word wrap enabled |
Multiple badges can appear at once when a mode and a display option are both active — for example [log] and [wrap] together.
Optional Dependencies¶
Some preview features require external tools. Trek detects them at runtime and falls back gracefully when they are absent, showing a short install hint in the preview pane.
| Tool | Purpose | Install (macOS) |
|---|---|---|
chafa |
Inline image rendering — renders raster images as Unicode block characters or sixels in the preview pane | brew install chafa |
pdfinfo (poppler-utils) |
Full document metadata for PDF files | brew install poppler |