# Editor

> Edit files with multiple cursors, find and replace, a symbol outline and syntax highlighting.

Files open in Rexa's editor as center tabs. The editor highlights syntax with tree-sitter, shows git changes in the gutter, and gets diagnostics and go-to-definition from [language servers](/docs/workspace/language-servers).

## Editing

| Action                         | Shortcut                                                   |
| ------------------------------ | ---------------------------------------------------------- |
| Undo / redo                    | <Kbd>⌘</Kbd> <Kbd>Z</Kbd> / <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>Z</Kbd> |
| Delete line                    | <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>K</Kbd>                     |
| Move line up / down            | <Kbd>⌥</Kbd> <Kbd>↑</Kbd> / <Kbd>⌥</Kbd> <Kbd>↓</Kbd>      |
| Duplicate line up / down       | <Kbd>⌥</Kbd> <Kbd>⇧</Kbd> <Kbd>↑</Kbd> / <Kbd>⌥</Kbd> <Kbd>⇧</Kbd> <Kbd>↓</Kbd> |
| Outdent / indent               | <Kbd>⌘</Kbd> <Kbd>[</Kbd> / <Kbd>⌘</Kbd> <Kbd>]</Kbd>      |
| Toggle comment                 | <Kbd>⌘</Kbd> <Kbd>/</Kbd>                                  |
| New line below / above         | <Kbd>⌘</Kbd> <Kbd>↵</Kbd> / <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>↵</Kbd> |
| Delete to line start / end     | <Kbd>⌘</Kbd> <Kbd>⌫</Kbd> / <Kbd>⌘</Kbd> <Kbd>Delete</Kbd> |
| Save / save all                | <Kbd>⌘</Kbd> <Kbd>S</Kbd> / <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>S</Kbd> |

Emacs-style keys work too: <Kbd>⌃</Kbd> <Kbd>A</Kbd>, <Kbd>⌃</Kbd> <Kbd>E</Kbd>, <Kbd>⌃</Kbd> <Kbd>K</Kbd> and the rest. Brackets and quotes auto-pair, new lines auto-indent, and <Kbd>Tab</Kbd> inserts spaces.

In the editor, <Kbd>⌘</Kbd> <Kbd>I</Kbd> writes a [comment for an agent](/docs/review/comments) and <Kbd>⌘</Kbd> <Kbd>L</Kbd> adds the selection to an agent's prompt.

## Selection and multiple cursors

- **Click** twice for a word, three times for a line, four times for the whole file. <Kbd>⇧</Kbd>-click extends.
- <Kbd>⌘</Kbd> <Kbd>D</Kbd> adds the next occurrence of the selection.
- <Kbd>⌥</Kbd>-click adds a cursor. Set `editor.multi_cursor_modifier` to `"cmd"` to use <Kbd>⌘</Kbd>-click instead.
- <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>↑</Kbd> and <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>↓</Kbd> add a cursor above or below.
- <Kbd>Esc</Kbd> returns to one cursor.

## Find and replace

<Kbd>⌘</Kbd> <Kbd>F</Kbd> opens the find bar; <Kbd>⌘</Kbd> <Kbd>G</Kbd> finds the next match.

| In the find bar           | Shortcut                                              |
| ------------------------- | ----------------------------------------------------- |
| Previous match            | <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>G</Kbd>                |
| Toggle replace            | <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>H</Kbd>                |
| Replace / replace all     | <Kbd>↵</Kbd> / <Kbd>⌘</Kbd> <Kbd>↵</Kbd>              |
| Match case                | <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>C</Kbd>                |
| Whole word                | <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>W</Kbd>                |
| Regular expression        | <Kbd>⌘</Kbd> <Kbd>⌥</Kbd> <Kbd>R</Kbd>                |
| Search in selection       | <Kbd>⌥</Kbd> <Kbd>L</Kbd>                             |

Regex replacements expand `$1` captures. Outside the find bar, <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>G</Kbd> opens the Git panel.

## Navigate

- **Go to a line:** type `path:line` or `path:line:col` in quick open (<Kbd>⌘</Kbd> <Kbd>P</Kbd>).
- **Symbol outline:** <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>O</Kbd> lists the file's symbols. Moving through the list previews each one; <Kbd>↵</Kbd> jumps, <Kbd>Esc</Kbd> returns. It reads the syntax tree, so no language server is needed.
- **Go to definition:** <Kbd>F12</Kbd> or <Kbd>⌘</Kbd>-click. See [Language servers](/docs/workspace/language-servers).
- **Overview ruler:** the strip on the right edge marks the cursor, search matches and git changes. Click or drag it to scroll.

## Languages

Syntax highlighting is built in for:

Astro, Bash, C, C#, C++, CMake, CSS and SCSS, Dart, Diff, Dockerfile, `.env`, Elixir, git commit and rebase files, `.gitignore`-style files, Go, GraphQL, Haskell, HCL and Terraform, HTML, Java, JavaScript and JSX, JSON and JSONC, Kotlin, Lua, Make, Markdown and MDX, Nix, OCaml, PHP, Prisma, Protobuf, Python, Ruby, Rust, Scala, SQL, Svelte, Swift, TOML, TypeScript and TSX, Vue, XML, YAML and Zig.

Embedded languages are highlighted too, such as CSS and JavaScript inside HTML, and code fences in Markdown. Zed extensions add more languages; see [Themes and extensions](/docs/customize/themes-and-extensions).

## Saving and outside changes

- **Unsaved edits survive a quit.** They are restored with the tab on the next launch.
- **Files changed on disk reload** when the tab has no unsaved edits, keeping the cursor, scroll and undo history. With unsaved edits, the tab keeps your version.
- **No autosave.** Save with <Kbd>⌘</Kbd> <Kbd>S</Kbd>.
- **Files Rexa manages,** such as its saved state, open read-only.

## Git in the editor

The gutter marks changed lines, and inline blame shows who last changed the cursor's line. Right-click → **Copy As** copies the path, the relative path, a permalink to the lines on GitHub or GitLab, or the blame commit's SHA or message. See [Git](/docs/review/git#in-the-editor).

## Settings

<FieldGroup>
  <Field name="font_size" type="number" default="13.5">Text size for the whole app, 8 to 32.</Field>
  <Field name="font_family" type="string" default="'JetBrains Mono'">Any installed monospaced font.</Field>
  <Field name="font_weight" type="number" default="400">100 to 900.</Field>
  <Field name="editor.tab_size" type="number" default="4">Spaces per indent. A language's own setting wins.</Field>
  <Field name="editor.soft_wrap" type="boolean" default="false">Wrap long lines in code.</Field>
  <Field name="editor.markdown_soft_wrap" type="boolean" default="true">Wrap long lines in markdown source.</Field>
  <Field name="editor.line_numbers" type="boolean" default="true">Show line numbers.</Field>
  <Field name="editor.indent_guides" type="boolean" default="true">Show indent guides.</Field>
  <Field name="editor.highlight_active_line" type="boolean" default="true">Highlight the cursor's line.</Field>
  <Field name="editor.render_whitespace" type="boolean" default="false">Show spaces and tabs.</Field>
  <Field name="editor.syntax" type="boolean" default="true">Syntax highlighting.</Field>
  <Field name="editor.multi_cursor_modifier" type="'alt' | 'cmd'" default="'alt'">Modifier that adds a cursor on click.</Field>
  <Field name="editor.inline_blame" type="boolean" default="true">Show blame for the cursor's line.</Field>
  <Field name="editor.vim" type="boolean" default="false">[Vim mode](/docs/customize/vim).</Field>
</FieldGroup>

Most of these have a palette toggle, such as **editor: toggle soft wrap**.

## Not supported

Code folding, a minimap, sticky scroll, breadcrumbs, snippets, format on save, and column selection with the mouse.
