# Keyboard shortcuts

Every keyboard binding in Pasty, where it lives, and the shortcuts that were considered and not built, with the conflict that decided each one. Chords are written for macOS: `⌘` is `Ctrl` elsewhere, `⌥` is `Alt`, `⇧` is `Shift`.

## The command palette

`⌘K` (`Ctrl+K` off macOS) opens the command palette: Copy Markdown, Share, New document, Rename, Delete document, Insert link, appearance, Vim mode, Settings, your documents by title, and the account actions. It is also the cheat sheet. A row with a chord of its own shows it as a keycap, and the chord works from anywhere on the page, palette open or not.

## Global

These work from anywhere on the page, in the editor, in the title field, or with the palette open, and every one of them shows as a keycap in `⌘K`.

| Chord       | Does                              | Notes                                                                                                  |
| ----------- | --------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `⌘K`        | Open or close the command palette | The one chord the header advertises                                                                    |
| `⌘⇧C`       | Copy Markdown                     | Reclaimed from the devtools element picker, which keeps `⌘⌥I` and its button                           |
| `⌘⇧L`       | Share / Unshare document          | Shares and copies the link, or stops sharing, as the row says; signed out, shows the signup invitation |
| `⌘⌥N`       | New document                      | Not `⌘N`: Chrome and Firefox reserve it for a new window and never let a page cancel it                |
| `⌘⇧R`       | Rename document                   | Signed in only, like the row; puts the caret in the title with it selected                             |
| `⌘,`        | Settings                          | A toggle: press again to close                                                                         |
| `⌘1` … `⌘9` | Recent documents                  | Most recent first, skipping the document on screen; signed in only                                     |
| `⌘⇧K`       | Insert link                       | Shown in the palette, but owned by the editor keymap because it needs the caret                        |

A digit with no document behind it (`⌘3` with two other documents, any digit signed out) is left to the browser, so it still switches tabs. Under the Settings dialog only `⌘,` acts. A claimed chord is also stopped from reaching the editor, because off macOS `Ctrl+Shift+R` would otherwise be Vim's redo and `Ctrl+Shift+C` its Escape.

`⌘⌥N` rather than `⌘N` because Chrome and Firefox reserve `⌘N` for a new window and never let a page cancel it. The link editor is `⌘⇧K` rather than the `⌘K` other editors use because the palette took the plain chord.

## In the editor

Advertised in the toolbar's tooltips.

| Chord                 | Does                                                    |
| --------------------- | ------------------------------------------------------- |
| `⌘Z` / `⌘⇧Z`          | Undo / redo                                             |
| `⌘B` / `⌘I`           | Bold / italic                                           |
| `⌘E`                  | Inline code                                             |
| `⌘⌥C`                 | Code block                                              |
| `⌘⇧B`                 | Quote                                                   |
| `⌘⇧8` / `⌘⇧7` / `⌘⇧9` | Bulleted / numbered / task list                         |
| `⌘⌥1` `⌘⌥2` `⌘⌥3`     | Heading 1–3                                             |
| `⌘⌥0`                 | Normal text                                             |
| `Tab` / `⇧Tab`        | Indent or outdent a list item; move between table cells |
| `⌘`-click             | Edit a link (a plain click follows it in a new tab)     |

Click a link to open it in a new tab, the way a link works everywhere else. `⌘`-click (`Ctrl`-click off macOS) opens the link editor instead, with the caret in the link, so the words and the address can be fixed. A link that goes nowhere (an anchor, a placeholder, a `javascript:` address) opens the editor on a plain click too, because a link that cannot be followed is one that needs fixing.

Installed and live, but not advertised anywhere:

| Chord             | Does                                               | Why it is quiet                                                           |
| ----------------- | -------------------------------------------------- | ------------------------------------------------------------------------- |
| `⌘⇧S`             | Strikethrough                                      | Valid GFM, kept in the schema, no toolbar button                          |
| `⌘⌥4` `⌘⌥5` `⌘⌥6` | Heading 4–6                                        | The schema holds them for pasted documents; no button                     |
| `⌘Y`              | Redo (alias)                                       | Tiptap's default; takes Chrome's History chord while the editor has focus |
| `⇧↩` / `⌘↩`       | Hard line break                                    | Tiptap's default                                                          |
| `⌘⌫` / `⌘⌦`       | Delete to line start or end, list- and table-aware | Tiptap's list and table keymaps refine the native chords                  |

`⌘U` (underline) is deliberately off: underline has no Markdown.

## Surfaces

| Where                       | Keys                                                                             |
| --------------------------- | -------------------------------------------------------------------------------- |
| Palette                     | Type to filter, `↑` `↓` move, `↩` runs, `Esc` or `⌘K` closes, click the backdrop |
| Menus and the Share popover | `↑` `↓` between rows, `Esc` closes                                               |
| Link editor                 | `Esc` closes                                                                     |
| Title field                 | `↩` returns the caret to the document                                            |
| Settings dialog             | `Esc` or Done                                                                    |
| Vim command line            | `↩` runs, `Esc` cancels                                                          |

## Vim mode

Opt-in, off by default, from `⌘K` or Settings. A full modal layer: motions, counts, operators (`d c y > <`), text objects, registers, marks, search (`/ ? n N * #`), character find, macros, the scroll family (`<C-e> <C-y> <C-d> <C-u> <C-f> <C-b>`), and `:w`, `:s`, `:%s`, `:noh`. The ownership rule: `⌘` and `⌥` chords always pass through to the application (which is why every global chord above still works in NORMAL mode), `Ctrl` chords belong to Vim in NORMAL and VISUAL and to the platform in INSERT, and `Esc`, `Ctrl-[` and `Ctrl-C` leave INSERT. The full account is on the [Vim mode](/docs/vim-mode) page.

## Not yet: candidates

| Candidate                                                  | Chord                    | Conflicts                                                                         | Verdict                                                                         |
| ---------------------------------------------------------- | ------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| Save now                                                   | `⌘S`                     | Browser Save Page As, cancellable everywhere; nothing in the editor; Vim has `:w` | Worth doing. It is the reflex everyone has, and today it opens a save dialog    |
| Insert table                                               | `⌘⌥T`                    | Safari's Show/Hide Toolbar (cancellable); free in Chrome and Firefox              | Good fit: the toolbar button has no chord, and it joins the `⌘⌥` block family   |
| Toggle a task item done                                    | `⌘↩`                     | Tiptap's hard break, which `⇧↩` also does                                         | Cheap, and the Notion/Things idiom                                              |
| Open the link under the caret                              | `⌥↩`                     | None                                                                              | Today only a click does this                                                    |
| Strikethrough                                              | `⌘⇧S`                    | Already works                                                                     | A discoverability gap, not a binding: a toolbar button or tooltip               |
| Headings 4–6                                               | `⌘⌥4–6`                  | Already work                                                                      | Only worth advertising if H4–H6 get UI                                          |
| Keyboard help                                              | `⌘/`                     | Safari's Show Status Bar (cancellable)                                            | Low value: `⌘K` already is the cheat sheet. At most an alias for it             |
| Move block up or down                                      | `⌥↑` `⌥↓` or `⌘⇧↑` `⌘⇧↓` | Native caret and selection movement in a contenteditable                          | Park: it would override editing behaviour without a strong reason               |
| Indent / outdent                                           | `⌘]` `⌘[`                | Browser back and forward                                                          | Don't: `Tab` and `⇧Tab` already do it, and the failure mode is leaving the page |
| Previous / next document                                   | `⌘⇧[` `⌘⇧]`, `⌘⌥←` `⌘⌥→` | Reserved by Chrome for tab switching; the page never sees them                    | Can't. `⌘1`–`⌘9` cover it                                                       |
| Rename alias for Windows habits                            | `F2`                     | None                                                                              | A hidden second chord; skip unless asked                                        |
| Vim toggle, appearance, log out, CLI access, sign in or up | —                        | —                                                                                 | None on purpose: infrequent, and a filled column is decoration                  |
| Delete document                                            | —                        | —                                                                                 | It exists now, in the palette. Still no chord, on purpose                       |

## Chords still free, and chords to leave alone

Free in Chrome, Firefox and Safari on macOS: `⌘⇧E`, `⌘⇧U`, `⌘⇧X`, `⌘⌥T`, `⌘⌥` with most other letters (`C` and `N` are taken), `⌥↩`, `⌘/`, and `⌘S` (a cancellable save dialog).

Cancellable but a real browser feature, so only with a reason: `⌘⇧D` (bookmark all tabs, Safari's Reading List), `⌘⇧M` (Chrome's profile menu), `⌘⇧O` (Firefox's bookmarks), `⌘⇧A` (Chrome's tab search), `⌘⇧H` (home), `⌘⇧J` (downloads), `⌘⇧G` (find previous), `⌘D` (bookmark), `⌘L` (address bar), `⌘F` (find), `⌘R` (reload), `⌘Y` (history), `⌘P` (print), `⌘O` (open file).

Off limits: `⌘N` `⌘T` `⌘W` `⌘Q` `⌘⇧N` `⌘⇧T` `⌘⇧W` `⌘⇧P` `⌘⇧[` `⌘⇧]` `⌘⌥←` `⌘⌥→` `Ctrl-Tab` (reserved by Chrome or Firefox), `⌘H` and `⌘M` (macOS hides and minimises), `⌘A` `⌘C` `⌘V` `⌘X` `⌘⇧V` `⌘⌫` and the arrow keys with any modifier (native editing), and `Ctrl` with a letter (macOS's emacs bindings in a text field, and Vim's in NORMAL and VISUAL).
