# Editing code

Source: https://athas.dev/docs/editing

Save files, use multiple cursors, fold code, and preview Markdown in Athas.

Open a file from the file tree or [Quick Open](https://athas.dev/docs/quick-open). Changes stay in the editor
buffer until you save, unless you enable Auto Save in Settings.

## Save and recover tabs

| Action            | Default shortcut   |
| ----------------- | ------------------ |
| Save current file | `Cmd/Ctrl+S`       |
| Save as           | `Cmd/Ctrl+Shift+S` |
| Save all files    | `Cmd/Ctrl+Alt+S`   |
| New tab           | `Cmd/Ctrl+N`       |
| Close current tab | `Cmd/Ctrl+W`       |
| Reopen closed tab | `Cmd/Ctrl+Shift+T` |

When sharing or reviewing work, distinguish an unsaved buffer from the file on disk.
[Share Buffer to Web](https://athas.dev/docs/sharing) can include unsaved text; your build and Git tools read saved files.

## Multiple cursors and selections

Select a word and use **Add Selection To Next Find Match** (`Cmd/Ctrl+D`) to extend the edit to
another occurrence. The command palette also offers **Select All Occurrences of Find Match**,
**Add Cursor Above**, **Add Cursor Below**, and **Remove Secondary Cursors**.

Use multiple cursors for repeated local edits. For a project-wide rename or replacement,
inspect [Search](https://athas.dev/docs/search) results and use language tooling where available.

## Lines, comments and folding

The command palette includes **Duplicate Line**, **Delete Line**, **Move Line Up/Down**,
**Toggle Comment**, **Fold All**, **Unfold All**, and folding by level. Supported comment syntax
and fold ranges depend on the active language.

## Markdown preview

Open a Markdown file and use **Preview Markdown** from the command palette. The preview follows
the current buffer, so you can inspect unsaved changes. Vim users can run `:preview`.

## Configure the editor

Use Settings for font, tab size, wrapping, line numbers, Auto Save, minimap and Vim mode.
[Formatting](https://athas.dev/docs/formatting) is separate from saving; enable format on save if you want both.
See [Keymaps](https://athas.dev/docs/keymaps) to inspect the binding for each action in your selected preset.
