# Keyboard Shortcuts

Tensormorph lets you perform almost every action - navigating the Outliner, framing a selection in the Architecture view, opening the command palette, stepping to the next flagged anomaly - from the keyboard. This page explains how the shortcut system works and how to customize it. For the full, current list of bindings, open **Preferences → Keyboard Shortcuts** inside the app; the table below documents the *decided defaults*.

Shortcuts in Tensormorph are **scoped to the focused view**, not global. The same key can do something different in the Architecture view than it does in the Matrix/Heatmap view, because only one view has focus at a time. Focus a view (click or hover, depending on your settings) to make it the active context for keyboard input.

## Global vs. view-scoped shortcuts

Every shortcut belongs to one of two scopes:

-   **Global** - available anywhere in the workbench, regardless of which view has focus (for example, `Ctrl+P` to open the command palette, or `F8` to jump to the next flagged anomaly).
-   **View-scoped** - only active while a specific view has focus. `F` (frame selection) is a good example: it means something in any 3D or 2D view, but is meaningless in the Console.

This split matters once several views are visible side by side - a common layout once you're comparing two models, or watching a tensor's Inspector panel update while navigating the Architecture view. Without view scoping, a single key could not mean two different things in two panels open at once.

## The Keyboard Shortcuts editor

Open it from **Preferences → Keyboard Shortcuts**, or via the command palette (`Ctrl+P`, then search "Keyboard Shortcuts"). It lists every command Tensormorph exposes, whether or not it currently has a binding, and lets you:

-   Search by command name or by pressing the key combination you want to look up
-   Rebind, add a second binding, or remove a binding for any command
-   Filter to see only shortcuts you've customized (**Source: User**)
-   See which view scope a binding belongs to, and its `when` condition (see below)

## How a binding is defined

Under the hood, every shortcut is a rule with the same three fields, stored in your user keybindings file:

```json
{ "key": "ctrl+p", "command": "workbench.openPalette" },
{ "key": "d",      "command": "diff.toggle",  "when": "viewHasComparablePair" },
{ "key": "f8",     "command": "problems.nextAnomaly" }
```

-   **`key`** - the physical key combination, e.g. `ctrl+p`.
-   **`command`** - the identifier of the action to invoke.
-   **`when`** *(optional)* - a boolean expression over context keys (which view has focus, whether a comparable pair is loaded, and so on). Omit it and the binding is available everywhere.
-   Rules are evaluated bottom-to-top; the first rule whose `key` and `when` both match wins, so entries you add in your personal keybindings file are appended after - and can override - the defaults.

**Chords** (two keys pressed in sequence, not together) follow the same space-separated notation as VS Code's, for example `ctrl+k ctrl+s` for a secondary action grouped under a mnemonic prefix.

## Default shortcuts

| Action                               | Default         | Scope                                  |
| ------------------------------------ | --------------- | -------------------------------------- |
| Open the command palette             | `Ctrl+P`        | Global                                 |
| Frame the current selection          | `F`             | Any 3D/2D view                         |
| Frame the whole model                | `Home`          | Any 3D/2D view                         |
| Isolate the current selection        | `/`             | Any 3D/2D view                         |
| Hide the current selection           | `H`             | Any 3D/2D view                         |
| Switch view (1 = 3D, 2 = 2D, 3 = 1D) | `1` / `2` / `3` | Global                                 |
| Toggle diff overlay                  | `D`             | Any view with a loaded comparison pair |
| Jump to the next flagged anomaly     | `F8`            | Global (Problems panel)                |

All bindings above are remappable from the Keyboard Shortcuts editor; none are reserved.

This page is an initial draft - Tensormorph's decided default bindings are limited to the table above as of this writing; remaining commands are bindable but have no assigned default yet.

## Workspace presets

Beyond individual shortcuts, Tensormorph ships a set of named workspace presets - full view/panel layouts geared to a task (Architecture, Compare, Morph, MoE, Runtime, and Performance among them) - switchable from the workspace picker or bound to a shortcut of your choice. A preset changes which views and panels are visible, not their keybindings.

## Detecting and resolving conflicts

If two commands end up bound to the same key in the same scope, right-click either entry in the Keyboard Shortcuts editor and choose **Show Same Keybindings** to see every rule mapped to that combination. The most specific `when` clause - the one naming the narrowest view scope and selection state - wins; if two rules are equally specific, the one lower in your keybindings file wins.

## Related resources

-   [Commands](/docs/reference/commands) - the full list of invokable command identifiers usable in a `key` binding.
-   [Settings](/docs/reference/settings) - where your keybindings file lives relative to your other user and project settings.
-   [TQL: Expressions and Queries](/docs/reference/expressions-and-queries) - the `?`-prefixed natural-language-to-TQL and `:`-prefixed filter shortcuts available from the same palette.
