# Keys

Every key the diagram page and the editor use, in one place.

## Diagram page

| Does                                   | Mac              | Windows and Linux                          |
| -------------------------------------- | ---------------- | ------------------------------------------ |
| Open the command palette               | **⌘K**           | **Ctrl+K**                                 |
| Open a published diagram (Line9 Pro)   | **⌘O**           | **Ctrl+O**                                 |
| Show or hide the diagram's text        | **⌘U**           | **Ctrl+U**                                 |
| Enter or leave the Line9 editor        | **⌘E**           | **Ctrl+E**                                 |
| Show or hide the style and zoom panels | **⌘I**           | **Ctrl+I**                                 |
| Hide everything but the menu           | **⌘.**           | **Ctrl+.**                                 |
| Full screen                            | **⌘↩**          | **Ctrl+Enter**                             |
| Zoom in, zoom out                      | **⌘=**, **⌘-**   | **Ctrl+=**, **Ctrl+-**                     |
| Zoom with the mouse                    | **⌘** and scroll | **Ctrl** and scroll                        |
| Fit the diagram in view                | **⌘0**           | **Ctrl+0**                                 |
| Find in the diagram                    | **⌘F**           | **Ctrl+F**                                 |
| Undo                                   | **⌘Z**           | **Ctrl+Z**                                 |
| Redo                                   | **⇧⌘Z**          | **Shift+Ctrl+Z**, or **Ctrl+Y** on Windows |
| Copy as PNG                            | **⌘C**           | **Ctrl+C**                                 |
| Publish (Line9 Pro)                    | **⌘S**           | **Ctrl+S**                                 |
| Print                                  | **⌘P**           | **Ctrl+P**                                 |
| List the keyboard shortcuts            | **⌘/**           | **Ctrl+/**                                 |

These need no **⌘** or **Ctrl**:

| Keys       | Does                                               |
| ---------- | -------------------------------------------------- |
| **Space**  | Open the menu                                      |
| **Enter**  | Enter the Line9 editor                             |
| Arrow keys | Move the diagram. Add **Shift** to move it further |
| **Esc**    | Close a menu or panel                              |

## Editor: Edit mode

| Keys                              | Does                                                  |
| --------------------------------- | ----------------------------------------------------- |
| `h` `j` `k` `l` or the arrow keys | Move the cursor to the next node in that direction    |
| `f`, then a code                  | Move the cursor to the item with that code            |
| `/`, then part of a label         | Search; `n` and `N` go to the next and previous match |
| `e`, then a code                  | Move the cursor to one of the item's edges            |
| `zz`                              | Centre the view on the cursor                         |
| **F2**, `i` or `a`                | Edit the label                                        |
| `cc`                              | Change the label                                      |
| `ce`, then a code                 | Change the label of one of the item's edges           |
| `o`, `O`                          | Add a node after, or before                           |
| `>`, then a move                  | Connect to the node you move to                       |
| `<`, then a move                  | Connect from the node you move to                     |
| `dd`, **Delete** or **Backspace** | Delete the item                                       |
| `de`, then a code                 | Delete one of the item's edges                        |
| `dig`                             | Delete the group, with everything in it               |
| `v`                               | Start Visual mode                                     |
| `u`                               | Undo                                                  |
| `:`                               | Open the `:` line                                     |
| **Enter**                         | Show the commands for the item                        |
| `?`                               | List the keys that work now                           |
| **Esc**                           | Cancel a key that is waiting for the next one         |
| `:q`                              | Leave the editor                                      |

On the `:` line, **Enter** runs the command, **Tab** completes a choice and **Esc** closes it. The commands are `:shape`, `:line`, `:group`, `:class` (or `:style`), `:title`, `:e!` and `:q`. See [Editor reference](/docs/editor#the-line).

## Editor: Visual mode

| Keys           | Does                                                       |
| -------------- | ---------------------------------------------------------- |
| `v` or **Esc** | End the selection                                          |
| Any move       | Add the node you move to                                   |
| `ig`           | Add everything in the group                                |
| `e`            | Select the edges between the selected items                |
| `c` or **F2**  | Change a label: the selected item's, or one chosen by code |
| `d`            | Delete everything selected                                 |
| `>` or `<`     | Connect the two selected nodes, one way or the other       |
| `:`            | Run a command on everything selected                       |

## Editor: Insert mode

| Keys                             | Does                                                |
| -------------------------------- | --------------------------------------------------- |
| **Enter**                        | Keep the label                                      |
| **Esc**                          | Keep what you typed, or cancel if you typed nothing |
| **Shift+Enter** or **Alt+Enter** | Start a new line in the label                       |

## Next

- [Editor reference](/docs/editor): every editor command, with its mouse action.
- [How the Line9 editor works](/docs/how-the-editor-works): modes, the cursor and the selection.
