# Files and editor
Source: https://docs.hercus.dev/features/files/
Last updated: 2026-10-18

Browse your workspace's files, edit them, preview documents, and review changes hunk by hunk.

The **Files** panel shows your workspace’s folder. Files you open appear in the editor beside it. **Files** is the first panel a new workspace shows; to open it, show the sidebar (<kbd>⌘B</kbd>) and select **Files**.

## Browse files

- Select **Search Files** to find a file by name.
- To add a file or folder, select **New File...** or **New Folder...**.
- Drag files and folders to move them.

Right-click a file or folder for more:

| Item | What it does |
| --- | --- |
| **Rename...** (<kbd>F2</kbd>) | Renames it. |
| **Duplicate** | Makes a copy next to it. |
| **Copy Path**, **Copy Relative Path** | Copies its full path, or its path inside the project. |
| **Copy File Content** | Copies the file’s text. |
| **Reveal in Finder** | Shows it in Finder. |
| **Open in Terminal** | Opens a terminal in that folder, or in the file’s folder. |
| **Delete** | Moves it to the macOS Trash. |
| **Delete Permanently** | Deletes it for good, after you confirm. This can’t be undone. |

The panel header shows **WORKSPACE** while you’re looking at the workspace’s folder. To see the project’s main folder instead, select **Show Project Files** next to it. This matters in a workspace with its own branch, where the two folders differ. The **Git**, **PRs**, and **CI** panels have the same switch.

## Edit files

Select a file to open it in the editor. Each workspace keeps its own tabs. You can also open a file from the Command Palette (<kbd>⌘P</kbd>) by typing part of its name.

- Hercus saves your changes about a second after you stop typing. Press <kbd>⌘S</kbd> to save right away. If a save fails, select **Retry save**.
- When an agent changes a file you have open, the editor reloads it, unless you have unsaved changes.
- Right-click a tab for **Close Other Tabs**, **Close Tabs to the Right**, and **Close All Tabs**.

### Ask an agent to change code

1. In the editor, select the code you want to change.
2. Press <kbd>⌘I</kbd> to open **Inline Edit**.
3. Describe the change, for example “Add error handling”, and press <kbd>Enter</kbd>.

An agent rewrites the selected code in place. Press <kbd>⌘Z</kbd> to undo it. To stop while it’s working, select **Abort**. Press <kbd>Esc</kbd> to close the box.

## Previews

Some files open as a preview instead of in the editor:

| File | Opens as |
| --- | --- |
| Markdown | A rendered page, including Mermaid diagrams. Hercus can’t edit Markdown files; ask an agent to change them. |
| Images and PDFs | The image or document. |
| CSV and TSV | A table. |
| Other binary files | A message that there’s no preview. |

## Review changes in a diff

When you select a changed file in the [Git](https://docs.hercus.dev/features/git/) panel, its diff opens in the editor area:

- **Inline view** and **Side-by-side view** switch the layout.
- **Previous change** and **Next change** jump between changes.
- On each change, **Stage hunk**, **Unstage hunk**, and **Discard hunk** act on just that part of the file, so you can keep some of a file’s changes and drop the rest.

## Open files from Finder

- Drag a file onto the Hercus window to open it.
- Drag a folder onto the window to add it as a project, or to switch to it if it’s already one.
