# Keyboard shortcuts

Source: https://api-genie.dev/docs/guides/editor/keyboard-shortcuts

The editor follows the keys of VS Code where both have the same part. `Ctrl` stands for `Cmd` on
macOS throughout. In VS Code, the editor's own shortcuts give way to VS Code's: *Save*, *Undo* and
*View* are VS Code's keys.

## The window

| Key | Does |
| --- | --- |
| `Ctrl+S` | Save every unsaved file |
| `Ctrl+Z`, `Ctrl+Shift+Z` | Undo and redo, from the desktop's *Edit* menu and in the code editor (`Ctrl+Y` redoes there too); elsewhere, the toolbar's *Undo* and *Redo* |
| `Ctrl+N` | *File › New…*, a new spec (desktop) |
| `Ctrl+O` | *File › Open Spec…* (desktop) |
| `Ctrl+Shift+S` | *File › Save As…* (desktop) |
| `Ctrl+W` | *File › Close Spec* (desktop) |
| `Ctrl+B`, `Ctrl+J`, `Ctrl+Alt+B` | Show or hide the side bar, the panel and the right pane (desktop; `Cmd+Option+B` on macOS) |
| `Cmd+Q` | Quit (desktop, macOS; elsewhere *File › Exit*, without a key) |
| `Escape` | Close a menu or a dialog, cancel a drop |

In the web editor and in VS Code, the status bar's problem counts show and hide the panel.

## The tree

With a row of the tree focused:

| Key | Does |
| --- | --- |
| `↑`, `↓` | The row above or below |
| `Home`, `End` | The first or the last row |
| `→` | Open a closed section; in an open one, go to its first child |
| `←` | Close an open section; in a closed one, go to the parent |
| `Enter`, `Space` | Select the row, and open its form |
| `F2` | Rename the entry |
| `Delete` | Delete the entry, after a confirmation |
| `Insert` | Add an entry to the section |
| `Shift+F10`, the menu key | Open the row's menu |

## The splitters

Focus a splitter between two parts of the window with `Tab`, then:

| Key | Does |
| --- | --- |
| `←`, `→` or `↑`, `↓` | Move the splitter one step; with `Shift`, a large step |
| `Home`, `End` | Move it as far as it goes, either way |
| `Enter` | Put it back to its default position |

## The code editor

The code editor of *Show as code* and of a file shown as code has the keys of CodeMirror, which
are those of VS Code for the most part:

| Key | Does |
| --- | --- |
| `Ctrl+F` | Search and replace; `Enter` and `Shift+Enter` go to the next and the previous match |
| `Ctrl+Space` | Completions for the keys allowed at the cursor |
| `Tab`, `Shift+Tab` | Indent and outdent the selected lines |
| `Alt+↑`, `Alt+↓` | Move the line up or down; with `Shift`, copy it |
| `Ctrl+/` | Comment or uncomment the line |
| `Ctrl+Shift+K` | Delete the line |
| `Ctrl+Shift+[`, `Ctrl+Shift+]` | Fold and unfold the block at the cursor (`Cmd+Alt+[` and `]` on macOS); the gutter's arrows do the same |
| `F8` | Go to the next problem; `Ctrl+Shift+M` lists the problems of the file |
| `Ctrl+D` | Select the next occurrence of the selection |
| `Escape` | Close the search, the completions or a selection with several cursors |

## Try it out

| Key | Does |
| --- | --- |
| `Ctrl+Enter` | Send the request |
| `Escape` | Cancel the request that is running |

## Next

[Settings](/docs/guides/editor/settings) says what the editor remembers and where.
