# Files

> Browse a session's files read-only in the Files tab, find files and text with the file picker, pin results, and open file links from terminal output.

Flow gives each session a way to look at its code without leaving the workspace:

- **The Files tab** is a read-only, editor-style browser of the session's working directory, with an explorer, syntax-highlighted code, git change markers, find in file and a Markdown preview.
- **The file picker** (`⌘P`, `⇧⌘F`) finds files by name or by content, lists the branch's changes, and keeps your recent and pinned files per repository.
- **File links** make every path a terminal prints clickable, opening it in a Files tab at the right line.

Nothing here edits your files. The only write is **Revert** on a changed hunk, and Flow asks before it reverts.

## Open a Files tab

- Run **Browse files** from the [command palette](https://flow.worldbreakstudios.com/docs/getting-started/command-palette.md) (`keyboard.new_files_tab`, unbound by default). It opens a new Files tab on the session's working directory in the focused tile. Each new tab is separate, with its own open files.
- Right-click a tile's **+** button and pick **Files**.
- Pick a file in the [file picker](#find-file-and-search-in-files), or click a [file link](#file-links-in-terminal-output) in a terminal. Both reuse the session's Files tab on that folder when there is one.
- In a pull request review tab's Changes view, use **Open in Files** (`⌥⌘O`, `keyboard.open_in_files`, or right-click a diff row). It opens that file at that line in a Files tab on the PR's local checkout, and is disabled for a file the PR deletes or a branch that is not checked out locally.

A Files tab remembers its open files, expanded folders, explorer width and label across restarts. To rename it, use **Rename…** in the tab chip's menu. A blank name goes back to the folder's name. Local tabs refresh by themselves when files change on disk. `⌘R` refreshes at once.

In a remote session, the tab browses the folder on the ssh host. In a session mirrored from a paired device, it browses that device's folder over your [Puddle](https://flow.worldbreakstudios.com/docs/features/puddle.md).

## The Files tab

The tab has three parts: the open-files bar on top, the code area on the left and the explorer on the right.

### Open-files bar

- **Preview tile.** A single click in the explorer opens a file as the *preview* tile (its name in italics), which the next single click replaces. Double-click a file, or press `↩` on it, to keep it open.
- **Switching and closing.** Click a tile to switch to it, and drag tiles to reorder them. Close a tile with its **×** or a middle click. `⌃Tab` / `⌃⇧Tab` cycle the open files, and `⌘W` closes the active file (with no file open, it closes the tab).
- **Names and status.** When two open files share a name, each tile shows a faint folder hint. Tiles carry the file's git status letter.
- **More controls.** **Close others** keeps only the active file. The **⌄** button lists every open file.

### Explorer

The explorer shows the folder tree, with git status letters (**M** modified, **A** added, **D** or **!** in red) on files.

- **Filter files** (`⌥⌘E`, `keyboard.filter_files`, or click the round field) switches the tree to a flat, fuzzy-ranked list of matching files, at most 80. The filter skips `.git`, `.hg`, `.svn`, `node_modules` and `target`, and stops after 5,000 entries (it says so when it does).
- **Compact folders** (the toggle in the explorer header) merges a chain of single-child folders into one row such as `src/app/core`.
- **Toggle file explorer** (`⇧⌘E`, `keyboard.toggle_files_explorer`) hides or shows the explorer. Drag its left edge to resize it (dragging it narrow closes it), and double-click the edge to reset its width. In a narrow pane the explorer hides automatically.
- **Right-click a row** for Add note, Annotate lines, Copy @mention, Copy path and Reveal in Finder. See [Notes](https://flow.worldbreakstudios.com/docs/features/notes.md).

Explorer keys, while the explorer has the keyboard:

| Key | Does |
|---|---|
| `j` / `↓`, `k` / `↑` | Move the cursor. On a file, it opens as the preview tile |
| `↩` | Keep a file open, or fold / unfold a folder |
| `Space` | Fold / unfold |
| `→` / `←` | Expand (or step into an open folder) / collapse (or jump to the parent) |

### Code view

Text files show with line numbers and syntax highlighting.

- **Selecting.** Click to place a caret, drag to select, and double- or triple-click to select a word or a line. `⌘C` copies the selection.
- **Caret keys.** While the code view has the keyboard, the arrows (and `j` / `k`) move the caret. `⌥←` / `⌥→` move by word. Home, End, `⌃A` and `⌃E` go to the line's start or end, PgUp and PgDn move a page, and `⌘↑` / `⌘↓` jump to the file's start or end. Hold ⇧ with any of them to extend the selection.
- **Leaving.** `Esc` collapses a selection, then hands the keyboard back to the explorer.
- **Code navigation.** ⌘-click a symbol to go to its definition. See [Code navigation](https://flow.worldbreakstudios.com/docs/features/code-navigation.md).

### Changes in the gutter

Lines that differ from git's index are marked in the gutter: green for added, amber for modified, a red mark for deleted. The **changes pill** in the breadcrumb row shows the totals (`+N −N`).

- **Peek.** Click a marker or the pill to open an inline peek of that hunk, with **Stage hunk**, **Revert** and **Add note**. `⌥⇧↓` / `⌥⇧↑` step through the hunks, and `Esc` closes the peek.
- **Revert** asks for confirmation first, because it cannot be undone.

### Find in file

`⌘F` (`keyboard.find_in_page`) over a text file opens the find widget, or the magnifier in the breadcrumb row does. A one-line selection seeds the query. With no text file shown, `⌘F` focuses the explorer's filter instead.

| Key (in the find field) | Does |
|---|---|
| `⌥1` / `⌥2` / `⌥3` | Text, Fuzzy or Semantic mode |
| `⌥C` / `⌥W` / `⌥R` | Match case / whole word / regular expression (Text uses all three; Fuzzy only case) |
| `⌥L` | Show or hide the results list |
| `↩` / `⇧↩` | Next / previous match (wrapping) |
| `↑` / `↓` | Step matches in Fuzzy mode |
| `Esc` | Close. The current match becomes the selection |

The count reads `N of M`. Text search stops at 2,000 matches (`2000+`), and Fuzzy lists the best 60 lines. An invalid regex says *Invalid regex*. **Semantic** mode is not available yet: it searches nothing and says *Coming soon*. The same widget also searches a Shells tab's output.

### Markdown preview

For a `.md`, `.markdown` or `.mdx` file, the **Preview** pill in the breadcrumb row (or **Toggle Markdown preview** in the palette, `keyboard.toggle_markdown_preview`, unbound) renders the file in a reading column. Mermaid diagrams render, and images show a placeholder. Click the pill again for the code. While the preview is on, the caret keys, code navigation and find don't act on the hidden code.

### Open in an editor

The **Open** button in the breadcrumb row opens the active file in the first installed editor among Zed, Cursor, VS Code and Xcode, else in the default app. Its menu lists every installed editor, plus **Reveal in Finder**, **Copy path** and **New terminal here**. **Open file in editor** (`⌘O`, `keyboard.open_in_editor`) does the same from the keyboard. A remote tab has only **Copy path**.

### What the preview shows

| File | Shown as |
|---|---|
| Text and code | The code view, up to 2 MB and 20,000 lines, each line cut at 4,000 characters |
| Images (`png`, `jpg`, `jpeg`, `gif`, `webp`, `bmp`, `svg`, `ico`, `tiff`, `heic`) | The image, inline |
| Web pages (`html`, `htm`), videos (`mp4`, `mov`, `webm`, `m4v`), PDFs | A card with **Open in webview**, which opens the file in a webview tab. With the web tabs experiment off, a plain notice |
| Binary, too large, missing or unreadable | A notice saying which |

Remote and paired-device tabs don't fetch images, videos or PDFs.

## Find file and search in files

The file picker is a large card in the command palette, with a ranked list on the left and a live preview on the right.

| Action | Default | Opens the picker in |
|---|---|---|
| Find file (`keyboard.find_file`) | `⌘P` | Files mode |
| Search in files (`keyboard.search_in_files`) | `⇧⌘F` | Grep mode |
| Show changes (`keyboard.show_changes`) | unbound | Changed mode |

The picker searches one **scope**: a session's directory, local or on an ssh host, or a flyover tab's. It starts with the focused session. `⌃R` (or a click on the folder chip) cycles the scope and keeps the query.

### Modes

`⇥` / `⇧⇥` cycle the modes and keep the query. Inside the picker, `⇧⌘G` jumps to Changed, `⌘E` to Recent and `⇧⌘O` to Pinned.

| Mode | Lists |
|---|---|
| **Files** | Every file in the scope, fuzzy-ranked. In a git checkout this is `git ls-files` (tracked and untracked, `.gitignore` respected). Otherwise ripgrep's or `find`'s file list, up to 100,000 files. The best 500 show |
| **Grep** | File contents, from 2 characters, through ripgrep with smart case. A query that is a valid regex runs as one, else as plain text. Up to 500 matches. Without ripgrep, `git grep` in a git checkout |
| **Defs** / **Refs** | Definitions / references of a symbol. See [Code navigation](https://flow.worldbreakstudios.com/docs/features/code-navigation.md) |
| **Changed** | The branch's changed files with `+` / `−` counts (see below) |
| **Recent** | Files you opened from the picker in this repository, newest first, up to 50 |
| **Pinned** | Your pinned files, then your pinned search results |

### Query syntax

Files mode uses fzf-style queries:

| Query | Matches |
|---|---|
| `foo bar` | Both terms, fuzzy, in any order |
| `'foo` | `foo` exactly, anywhere |
| `^foo` / `foo$` | Paths that start / end with `foo` |
| `!foo` | Paths without `foo` |
| `\ ` | A literal space |

Each term is case-insensitive unless it has an uppercase letter. Accents are ignored, so `cafe` finds `café.md`. Pinned files rank first.

### Picker keys

| Key | Does |
|---|---|
| `↩` | Opens the file, kept, in the scope session's Files tab (reused, so picks gather in one tab). A Grep, Defs or Refs hit lands on its line |
| `⌘↩` | Opens it in a Files tab in a new split to the right |
| `⌥↩` | Reveals its folder in the explorer |
| `↑` `↓`, `⌃N` `⌃P`, `⌃J` `⌃K` | Move the selection |
| `⌃D` | Pin or unpin the selection (see [Pinned files and pinned results](#pinned-files-and-pinned-results)) |
| `⌃Y` | Copy the selected file's full path |
| `⌃U` / `⌃D` | Scroll the preview half a page, after you click the preview |
| `⌃L` | Diff lens for a pinned result (Pinned mode) |
| `⌃B` | Changed: switch between the branch and uncommitted changes |
| `⌘C` | Copy the text selected in the preview |
| `⌫` on an empty query | Back to the palette |
| `Esc` | Close |

Drag the card's right or bottom edge to resize it, and drag the line between the list and the preview to resize the list. Flow remembers both, and a double-click on the divider resets it. The preview shows up to 200 lines of the file, draws images inline, and shows your [notes](https://flow.worldbreakstudios.com/docs/features/notes.md) on the file as cards.

### Changed mode

Changed lists what your branch changes, exactly as `git diff --stat $(git merge-base HEAD BASE)` would, including uncommitted work. The base is the open pull request's target when the branch has one, else `origin/HEAD`, `origin/main` or `origin/master` (then local `main` / `master`). The preview shows every hunk of the file, and `↩` opens the file at its first changed line. `⌃B` (or the **vs main | Uncommitted** toggle) switches to changes against `HEAD` only.

## Pinned files and pinned results

Pins belong to the **repository**, not the checkout. They show in every worktree of it, on its main checkout and in a clone on an ssh host. Pins and recents need a git repository (*Pins need a git repository*).

- **Pin a file.** Press `⌃D` on a file in Files, Recent or Changed. A pinned file that this branch doesn't have shows *not on this branch*, and `↩` loads the base branch's version read-only.
- **Pin a search result.** Press `⌃D` on a Grep, Defs or Refs hit. That pins the hit with its search (mode, query, line), not just the file, and the row shows a star. Flow keeps a snapshot of files up to 2 MB, so the pin can find its place again after the file changes. Pressing `⌃D` on the same hit again unpins it. A hit inside a dependency can't be pinned.

In Pinned mode each result pin shows where it stands now:

| Badge | Means |
|---|---|
| `exact` | The file is unchanged |
| `line N → M` | The pinned line moved |
| `line N · file changed` | The file changed but the line is still there |
| `changed · N matches` | The line is gone; the query matches again in the file |
| `file only` | Only the file is left; the pin opens at the old line |
| `moved → FILE:LINE` | The file is gone; its content was found in another file |
| `deleted or moved` | Nothing was found. `↩` opens nothing |
| `couldn't read` | The file could not be read; the preview says why |

`⌃L` turns on the **diff lens**, which shows the changes between the pinned snapshot and the file now.

## File links in terminal output

Paths a terminal prints become links, underlined like URLs. Flow recognises:

- absolute paths, `~/` paths, and `./` and `../` paths
- relative `dir/file` paths and bare `name.ext` names
- a `:line`, `:line:col` or `(line,col)` suffix
- the `a/` and `b/` prefixes git diff prints

A path is checked against the pane's working directory, then the repository top. A bare name or `dir/file` path is also matched against the repository's files. Folders link too. Numbers, dates and version strings never become links.

| Click | Does |
|---|---|
| Click | Opens the file in the session's Files tab on its repository (else its parent folder), at the line and column when the link named them. A folder is revealed and selected |
| ⇧-click | Reveals it in Finder |

A plain click opens a link only in the pane that already has the keyboard. A ⌘-click opens it from any pane. Dragging a selection over a link doesn't open it. When a name matches several files, its underline is thinner and fainter, and a click shows a menu of up to 20 candidates to choose from.

File links work in local panes only. A path the grid wrapped across rows is one link, but a path the program broke with its own newline is not.

## Images

Image files open inline in the Files tab and in the file picker's preview (see [What the preview shows](#what-the-preview-shows)).

### Claude image previews

> **Note:** Claude image previews are an experiment (BETA). Turn them on in Settings › Experiments (`features.claude_images`).

When you paste or drop an image into Claude Code, it prints an `[Image #N]` placeholder. With this experiment on, those placeholders in your local Claude Code panes become links once Claude Code has saved the image:

- **Hover** a placeholder to float a preview card of the image, captioned `Image #N`.
- **Click** (or ⌘-click) to open the image in a Files tab.
- **⇧-click** to reveal it in Finder.

A placeholder for an image that was never submitted stays plain text. If the file is gone or can't be decoded, the card says *Image not available*. While the experiment is off, the placeholders are plain text and Flow reads no extra transcripts.

### Image viewer

Clicking a loaded image on a pull request review tab, including a rendered Mermaid diagram, opens it enlarged in its own window: at full size, or scaled down to fit 90% of the display. Opening another image replaces the one shown. **Open in browser** appears when the image has a web URL. `Esc` or `⌘W` closes the viewer.

## Settings

| Setting | Type | Default | Effect |
|---|---|---|---|
| `files.compact_folders` | boolean | `true` | Merges single-child folder chains in the explorer (the Compact folders toggle) |
| `features.claude_images` | boolean | `false` | Claude image previews (Settings › Experiments) |
| `links.open_in` | `browser` or `app` | `browser` | Where web links open, including code search from the picker (needs `features.web_tabs` for `app`) |

The keyboard actions above are rebindable in Settings › Keyboard. See [Keyboard shortcuts](https://flow.worldbreakstudios.com/docs/getting-started/keyboard-shortcuts.md).

## From the command line

`flow-cli` can drive the focused session's Files tab (see [flow-cli](https://flow.worldbreakstudios.com/docs/cli/flow-cli.md)):

```sh
# Open a file (relative to the tab's folder) at line 120, kept rather than as the preview tile
flow-cli files-open src/main.rs --line 120 --keep
# Find in the active file
flow-cli files-find --query "TODO" --mode text --case on
flow-cli files-find --close
```

`files-open` needs the session's focused pane to be a Files tab, and both commands take `--group NAME` to pick the session. `flow-cli state` reports each Files tab's caret, selection, find widget and diff.

## Limits

- The Files tab is read-only. To edit, use **Open** (`⌘O`) to hand the file to your editor.
- Previews stop at 2 MB and 20,000 lines. Lines longer than 4,000 characters are cut.
- Tabs on a paired device have no git status, change markers, notes, code navigation or Markdown preview.
- Grep needs ripgrep, or `git grep` in a git checkout. Without either, Grep says ripgrep is not installed.
- Pins and recents exist only inside a git repository.
