Files

192 lines
11 KiB
Markdown

# File view
The file view is the third column (Col C), between the [Explorer](explorer.md) and the [Claude Code](claude-code.md) column. It shows one file at a time: a bar on top, the file below it.
[Guide index](index.md) · Related: [Markdown](file-view-markdown.md), [Diff](file-view-diff.md), [Code symbols](code-symbols.md), [Pass on to Agent](pass-on-to-agent.md), [Status bar](status-bar.md)
## At a glance
```text
+------------------------------------------------------------------+
| (1)[php] (2)app/Http/UserController.php (3)o (4)+12 -3 (5)[Diff] |
+------+-----------------------------------------------------------+
| (6)40| public function show(User $user) |
| 41| { |
| |42| $user->load('roles'); (7) changed line |
| |43| return view('users.show'); |
| =44| } (8) rule: lines removed here|
| 45| |
| | (9) the code: type here, select, right-click |
+------+-----------------------------------------------------------+
```
1. **Type badge**: a small coloured chip with the file extension.
2. **Path**: the file's path inside the project. A long path is cut at the start. Hover it to see it in full.
3. **Unsaved dot**: a small dot shows when the file has edits you have not saved.
4. **Change counts**: for a file with git changes, added lines in teal (`+12`) and removed lines in amber-deep (`-3`).
5. **View buttons**: **Preview** on Markdown files, **Diff** on changed files. The button of the current view is lit.
6. **Line numbers**: one number per line. Click a number to select that line.
7. **Changed line**: a line the change added or edited gets a teal tint, a teal left rule and a teal number.
8. **Removed-lines rule**: where lines were only removed, a thin amber-deep rule sits on the edge of the next line.
9. **Code**: the live, editable text of the file, with syntax colours.
## Features
### Open a file
- Click a file in the [Explorer](explorer.md), choose **Open in editor** (or **Open diff**) on a row in the [Git](git.md) view, pick a result in [Search](search.md), or use [Go to file](go-to-file.md).
- The new file replaces the one that was open. Helder shows one file at a time.
- A file always opens fresh from disk.
- When you open a file at a line (from Search or the [symbol popup](code-symbols.md)), that line moves to the middle of the pane and flashes amber for about a second.
- `composer.lock` never opens. A short "Too big." message shows over the column instead.
### The live view and changed lines
- A file without git changes opens as plain, editable code. It has no Diff button.
- A file with git changes opens in the same editable view, with its changed lines marked:
- Teal tint, teal left rule and teal line number: a line the file holds now that is new or edited.
- A thin amber-deep rule on the top edge of a line: lines were removed just above it. At the end of the file the rule sits under the last line.
- Removed lines never show inline. To see them, open the [Diff](file-view-diff.md).
- Right-click a marked line and choose **Show diff** to open the Diff centred on that line. A left click places the caret, as on any line.
- In a new file every line is teal, so its menu has no Show diff.
- The marks follow your edits once git sees the saved file.
### Edit and save
- Type to edit. Undo and redo work as usual (`Cmd+Z`, `Cmd+Shift+Z`).
- `Cmd+S` saves the file. A "Saved" [notification](notifications.md) confirms it. If the write fails, you see "Save failed" and the file stays open with your edits.
- `Cmd+S` on a file without edits does nothing.
- After a save, git re-reads, so the [Git](git.md) view and the status bar update.
### Auto-save
- Auto-save is off by default. Turn it on with `editor.autoSave` in the [configuration](configuration.md).
- With auto-save on, the file saves about 0.6 seconds after you stop typing. It shows no notification.
- Open edits are also written before the window closes or the project switches.
### Indentation
- `Tab` inserts spaces, never a tab character. The number of spaces is `editor.tabSize` (default 4).
- With several lines selected, `Tab` indents every line one level.
- `Shift+Tab` outdents every touched line one level. It removes one tab, or up to `tabSize` spaces.
- The [status bar](status-bar.md) shows the setting, for example `Spaces: 4`.
### Word wrap
- Long lines wrap onto the next row when word wrap is on. Otherwise you scroll sideways.
- `editor.wordWrap` sets it: `markdown` (default) wraps only Markdown files, `on` wraps every file, `off` wraps none.
- A wrapped line shows its number only on its first row.
### Line numbers and selection
- Line numbers are always shown.
- Click a line number to select that whole line. `Shift`+click another number to extend the selection to it.
- `Cmd+A` selects the whole file. It also works when the keyboard is not in the code, as long as a file is open.
- The [status bar](status-bar.md) shows the caret position as line and column.
### No guides or whitespace marks
- Helder draws no indent guides and no visible whitespace marks.
- The editable view does not tint the caret line. The caret itself is amber.
### Unsaved changes when you switch or close
- Open another file (or the same file again) while the current file has unsaved edits, and a dialog asks: **Save**, **Don't Save** or **Cancel**.
- **Save** writes the file, then opens the new one.
- **Don't Save** drops the edits, then opens the new one.
- **Cancel** keeps the current file and its edits.
- With auto-save on, Helder saves silently and does not ask.
- Closing the window or switching project asks the same question for every file with unsaved edits.
### Close a file
- `Cmd+W` closes the open file. With unsaved edits it asks Save, Don't Save or Cancel first.
- With no file open, `Cmd+W` closes the window.
### Empty state
With no file open, the bar is empty and the pane shows "No file open" with three shortcuts:
| Shortcut | Action |
|---|---|
| `Cmd+O` | Open folder |
| `Cmd+Shift+O` | [Recent projects](recent-projects.md) |
| `Cmd+F` | [Search files & content](search.md) |
### Files that are not plain text
- **Images** (png, jpg, gif, webp, svg, bmp, ico, avif and more) show as a picture, centred, on a checkerboard so transparent parts stay visible. They are read-only. An image that cannot be read shows "Can't preview this image".
- **Binary files** (pdf, zip, fonts, audio, video, databases and the like, or any file whose content turns out binary) show "This file cannot be displayed". There is no Preview or Diff button.
- **Deleted in the change**: a file git sees as deleted shows "No updated version" with the note "This file was deleted in the change." The Diff button still opens the old content.
- **Added in the change**: a new file shows all its lines in teal. In the Diff, the left side is empty.
- **Removed from disk while open**: the text stays on screen as unsaved edits, so nothing is lost. The unsaved dot shows. Save to write the file back, or close and choose Don't Save.
- **Too big**: `composer.lock` never opens. A changed file over 1 MB opens, but shows no line marks, and its Diff says "Too big."
### Changes on disk
- Helder watches the project. When a file changes on disk (for example, the agent edits it), the open file updates by itself.
- If you have unsaved edits, Helder keeps your edits and does not overwrite them.
- `Cmd+R` re-reads git, the file tree and the open file. For the open file the disk wins: unsaved edits are dropped without a prompt.
### Find
- The file view has no find bar of its own.
- `Cmd+F` opens project-wide [Search](search.md). With text selected, the first line of the selection fills the search field.
### Zoom
- **View > Zoom In** (`Cmd++`), **Zoom Out** (`Cmd+-`) and **Actual Size** (`Cmd+0`) change the text size, about 10 percent per step.
- Zoom applies to the code, the Diff and the terminals. The Markdown preview keeps its size.
### Right-click and pass on
- Right-click in the code for **Pass on reference** (or **Pass on selection** with text selected) and **Copy reference**.
- `Cmd+Right` with text selected opens the pass-on prompt for that selection.
- See [Pass on to Agent](pass-on-to-agent.md) and the [right-click menu](right-click-menu.md).
### Class names in PHP
- Hold `Cmd` to underline the class names the project declares. `Cmd`+click one to open the [symbol popup](code-symbols.md).
### Recent files
- `Cmd+Up` or `Cmd+Down` while you work in the file view opens the list of recently opened files. See [Go to file](go-to-file.md).
### Syntax colours
These file types get syntax colours:
| Language | Extensions |
|---|---|
| PHP (including Blade, HTML with PHP parts) | `.php` |
| JavaScript | `.js`, `.mjs`, `.cjs`, `.jsx` |
| TypeScript | `.ts`, `.tsx` |
| Python | `.py` |
| HTML, XML and Vue | `.html`, `.xml`, `.vue` |
| CSS | `.css`, `.scss` |
| JSON | `.json` |
| Markdown | `.md` (code blocks get the colours of their language) |
| Shell | `.sh`, `.bash`, `.env` files |
| YAML | `.yml`, `.yaml` |
Every other text file shows plain text. The status bar shows the language name.
## Keyboard
| Keys | Action |
|---|---|
| `Cmd+S` | Save the open file |
| `Cmd+W` | Close the open file (or the window when none is open) |
| `Cmd+M` | Switch a Markdown file between code and Preview |
| `Cmd+A` | Select the whole file |
| `Tab` / `Shift+Tab` | Indent / outdent |
| `Cmd+Z` / `Cmd+Shift+Z` | Undo / redo |
| `Cmd+Right` | Pass on the selection to the agent (with text selected) |
| `Cmd`+click | Open the symbol popup for a PHP class name |
| `Cmd+F` | Search the project, seeded with the selection |
| `Cmd+Up` / `Cmd+Down` | Recent files |
| `Cmd+R` | Reload from disk (drops unsaved edits) |
| `Cmd++` / `Cmd+-` / `Cmd+0` | Zoom in / zoom out / actual size |
## Settings
| Setting | Default | Effect |
|---|---|---|
| `editor.autoSave` | `false` | Save about 0.6 s after you stop typing, and never ask about unsaved edits |
| `editor.tabSize` | `4` | Spaces inserted by `Tab`, and the width of one indent level |
| `editor.wordWrap` | `markdown` | `markdown` wraps Markdown only, `on` wraps all files, `off` wraps none |
| `session.restoreOnLaunch` | `true` | Reopen the last open file when the project opens |
See [Configuration](configuration.md) for where these live.
## Related
- [File view: Markdown](file-view-markdown.md): the rendered Preview for Markdown files.
- [File view: Diff](file-view-diff.md): the full-screen side-by-side comparison.
- [Code symbols](code-symbols.md): where a PHP class is declared and used.
- [Pass on to Agent](pass-on-to-agent.md): send a line or a selection to Claude.
- [Git](git.md): the changes that drive the line marks and the counts.
- [Status bar](status-bar.md): caret position, indentation and language.
- [Layout](layout.md): how the File column shows, hides and resizes.