> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tablepro.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Keyboard Shortcuts

> Complete list of keyboard shortcuts for the SQL editor, data grid, tabs, Vim mode, and customization

# Keyboard Shortcuts

TablePro is keyboard-driven. Most actions have shortcuts, and most menu shortcuts are rebindable.

## Quick Reference

### Essential Shortcuts

| Action          | Shortcut      |
| --------------- | ------------- |
| Execute query   | `Cmd+Enter`   |
| New connection  | `Cmd+N`       |
| Open history    | `Cmd+Y`       |
| Settings        | `Cmd+,`       |
| Quick Switcher  | `Cmd+Shift+O` |
| Switch database | `Cmd+K`       |
| Close window    | `Cmd+W`       |
| Quit            | `Cmd+Q`       |

## SQL Editor

### File Operations

| Action        | Shortcut      |
| ------------- | ------------- |
| Open SQL file | `Cmd+O`       |
| Save file     | `Cmd+S`       |
| Save As       | `Cmd+Shift+S` |

### Query Execution

| Action                 | Shortcut          | Description                                                                        |
| ---------------------- | ----------------- | ---------------------------------------------------------------------------------- |
| Execute query          | `Cmd+Enter`       | Run query at cursor. Shows parameter panel if `:name` placeholders are detected    |
| Execute all statements | `Cmd+Shift+Enter` | Run all statements in the editor. Shows parameter panel if parameters are detected |
| Cancel query           | `Cmd+.`           | Stop the currently running query                                                   |
| Explain query          | `Option+Cmd+E`    | Show execution plan for query at cursor                                            |
| Format SQL             | `Cmd+Shift+L`     | Format the selected SQL, or the whole query when nothing is selected               |
| Save as Favorite       | `Cmd+D`           | Save the current query as a favorite                                               |

### Text Editing

| Action         | Shortcut      | Description                                                                                 |
| -------------- | ------------- | ------------------------------------------------------------------------------------------- |
| Select all     | `Cmd+A`       | Selects every line, including the final line when the document ends with a trailing newline |
| Cut            | `Cmd+X`       | Cuts the selection. With no selection, cuts the current line including its line break       |
| Copy           | `Cmd+C`       |                                                                                             |
| Paste          | `Cmd+V`       |                                                                                             |
| Undo           | `Cmd+Z`       |                                                                                             |
| Redo           | `Cmd+Shift+Z` |                                                                                             |
| Delete line    | `Cmd+Shift+K` |                                                                                             |
| Duplicate line | `Cmd+Shift+D` |                                                                                             |

### Navigation

| Action                | Shortcut                |
| --------------------- | ----------------------- |
| Start of line         | `Home` or `Cmd+Left`    |
| End of line           | `End` or `Cmd+Right`    |
| Start of document     | `Cmd+Home` or `Cmd+Up`  |
| End of document       | `Cmd+End` or `Cmd+Down` |
| Move line up          | `Option+Up`             |
| Move line down        | `Option+Down`           |
| Center cursor in view | `Ctrl+L`                |

### Find and Replace

| Action               | Shortcut       |
| -------------------- | -------------- |
| Find (in SQL editor) | `Cmd+F`        |
| Find and replace     | `Cmd+Option+F` |
| Find next            | `Cmd+G`        |
| Find previous        | `Cmd+Shift+G`  |

### Selection

| Action           | Shortcut          |
| ---------------- | ----------------- |
| Expand selection | `Cmd+Shift+Right` |
| Shrink selection | `Cmd+Shift+Left`  |

## Data Grid

### Navigation

| Action             | Shortcut    |
| ------------------ | ----------- |
| Move between cells | Arrow keys  |
| Next cell          | `Tab`       |
| Previous cell      | `Shift+Tab` |
| First row          | `Home`      |
| Last row           | `End`       |
| Page up            | `Page Up`   |
| Page down          | `Page Down` |

### Pagination

| Action        | Shortcut          |
| ------------- | ----------------- |
| Previous page | `Cmd+[`           |
| Next page     | `Cmd+]`           |
| First page    | `Cmd+Option+Up`   |
| Last page     | `Cmd+Option+Down` |

`Cmd+[` and `Cmd+]` page the data grid. In the SQL editor the same keys indent and outdent the selection, so the binding follows whichever has focus.

### Editing

| Action               | Shortcut                |
| -------------------- | ----------------------- |
| Edit cell            | `Enter`                 |
| Preview FK reference | `Space`                 |
| Cancel edit          | `Escape`                |
| Add row              | `Cmd+Shift+N`           |
| Duplicate row        | `Cmd+Shift+D`           |
| Delete row           | `Delete` or `Backspace` |
| Commit changes       | `Cmd+S`                 |

### Data Changes

| Action                                 | Shortcut                |                                   |
| -------------------------------------- | ----------------------- | --------------------------------- |
| Undo change                            | `Cmd+Z`                 |                                   |
| Redo change                            | `Cmd+Shift+Z`           |                                   |
| Commit all changes                     | `Cmd+S`                 |                                   |
| Create table from the Create Table tab | `Cmd+S` or `Cmd+Return` |                                   |
| Preview SQL                            | `Cmd+Shift+P`           | Preview pending SQL before commit |

### Selection

| Action                        | Shortcut                            |
| ----------------------------- | ----------------------------------- |
| Select cell                   | Click                               |
| Select row                    | Click row number                    |
| Select rectangular range      | Click + drag                        |
| Extend selection              | `Shift` + click                     |
| Add cell to selection         | `Cmd` + click                       |
| Select entire column          | `Cmd` + click column header         |
| Extend selection by one cell  | `Shift+Arrow`                       |
| Extend selection to grid edge | `Cmd+Shift+Arrow`                   |
| Clear cell selection          | `Escape`                            |
| Extend selection by row       | `Shift+Up` / `Shift+Down`           |
| Select to first row           | `Shift+Home`                        |
| Select to last row            | `Shift+End`                         |
| Extend selection by page      | `Shift+Page Up` / `Shift+Page Down` |
| Select all                    | `Cmd+A`                             |

### Clipboard

| Action                                                                       | Shortcut       |
| ---------------------------------------------------------------------------- | -------------- |
| Copy (cell value if a cell is focused on a single row, otherwise row(s) TSV) | `Cmd+C`        |
| Copy Rows as TSV                                                             | `Cmd+Shift+C`  |
| Copy as JSON                                                                 | `Cmd+Option+J` |
| Copy with Headers                                                            | `Cmd+Option+C` |

## CSV Inspector

Inherits the standard `NSDocument` shortcuts.

| Action                          | Shortcut                    |
| ------------------------------- | --------------------------- |
| Save                            | `Cmd+S`                     |
| Save As                         | `Cmd+Shift+S`               |
| Revert to Saved                 | `Cmd+Option+S`              |
| Toggle filter panel             | `Cmd+F`                     |
| Copy selected rows as TSV       | `Cmd+C`                     |
| Paste TSV as new rows           | `Cmd+V`                     |
| Add secondary sort column       | `Shift+Click` column header |
| Undo (cell edit, delete, paste) | `Cmd+Z`                     |
| Redo                            | `Cmd+Shift+Z`               |
| New CSV inspector tab           | `Cmd+T` (from a CSV window) |
| Close CSV tab                   | `Cmd+W`                     |

## Application

### Windows & Tabs

| Action             | Shortcut                |
| ------------------ | ----------------------- |
| Close window / tab | `Cmd+W`                 |
| New query tab      | `Cmd+T`                 |
| Switch to tab 1-9  | `Cmd+1` through `Cmd+9` |
| Next tab           | `Cmd+Shift+]`           |
| Previous tab       | `Cmd+Shift+[`           |
| Minimize           | `Cmd+M`                 |

### Connections

| Action                      | Shortcut        |
| --------------------------- | --------------- |
| New connection              | `Cmd+N`         |
| Switch connection           | `Cmd+Control+C` |
| Refresh connection          | `Cmd+R`         |
| Delete selected connections | `Cmd+Delete`    |

### View

| Action                 | Shortcut        |
| ---------------------- | --------------- |
| Toggle sidebar         | `Cmd+0`         |
| Focus sidebar filter   | `Cmd+Option+F`  |
| Show Tables sidebar    | `Cmd+Option+1`  |
| Show Favorites sidebar | `Cmd+Option+2`  |
| Toggle full screen     | `Cmd+Control+F` |
| Zoom in                | `Cmd+=`         |
| Zoom out               | `Cmd+-`         |

### Panels

| Action                | Shortcut       |
| --------------------- | -------------- |
| Query History         | `Cmd+Y`        |
| Toggle Cell Inspector | `Cmd+Option+I` |
| Toggle Results        | `Cmd+Option+R` |
| Settings              | `Cmd+,`        |

### Results

| Action           | Shortcut       |
| ---------------- | -------------- |
| Previous Result  | `Cmd+Option+[` |
| Next Result      | `Cmd+Option+]` |
| Close Result Tab | `Cmd+Shift+W`  |

### AI

| Action           | Shortcut       | Description                               |
| ---------------- | -------------- | ----------------------------------------- |
| Explain with AI  | `Cmd+L`        | Send current query to AI for explanation  |
| Optimize with AI | `Cmd+Option+L` | Send current query to AI for optimization |

## ER Diagram

These shortcuts apply when the ER Diagram view is focused. `Cmd+0` overrides Toggle Sidebar in this context.

| Action            | Shortcut      |
| ----------------- | ------------- |
| Zoom In           | `Cmd+=`       |
| Zoom Out          | `Cmd+-`       |
| Reset Zoom (100%) | `Cmd+0`       |
| Fit to Window     | `Cmd+Shift+0` |
| Copy to Clipboard | `Cmd+C`       |

## Alternative navigation (Ctrl+HJKL)

For keyboards without dedicated arrow keys (e.g., HHKB), Ctrl+HJKL works as arrow key alternatives throughout the app. These work alongside arrow keys, not as replacements.

| Shortcut            | Action                     | Where                                                                                                    |
| ------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------- |
| `Ctrl+J` / `Ctrl+N` | Move down / Next item      | Data grid, connection list, quick switcher, database switcher                                            |
| `Ctrl+K` / `Ctrl+P` | Move up / Previous item    | Data grid, connection list, quick switcher, database switcher                                            |
| `Ctrl+H`            | Move left / Collapse group | Data grid (column left), welcome panel (collapse group at any nesting level), onboarding (previous page) |
| `Ctrl+L`            | Move right / Expand group  | Data grid (column right), welcome panel (expand group at any nesting level), onboarding (next page)      |
| `Ctrl+Shift+J`      | Extend selection down      | Data grid                                                                                                |
| `Ctrl+Shift+K`      | Extend selection up        | Data grid                                                                                                |

## Vim Mode Keybindings

Turn on vim mode in **Settings > Editor > Vim mode**. A badge next to the editor shows the current mode.

See the [Vim Mode](/features/vim-mode) page for the full key reference.

<Note>
  Vim keys only apply in the SQL editor. The data grid and other panels keep their standard shortcuts. `Cmd+Enter` runs the query in any mode.
</Note>

## Filtering

| Action                          | Shortcut                 |
| ------------------------------- | ------------------------ |
| Toggle filter panel (table tab) | `Cmd+F`                  |
| Apply filters                   | `Enter` (in value field) |

## Table Structure

These shortcuts only apply when the table structure view is focused. They override `Cmd+1` through `Cmd+4` tab switching in that context.

### Navigation

| Action           | Shortcut |
| ---------------- | -------- |
| Columns tab      | `Cmd+1`  |
| Indexes tab      | `Cmd+2`  |
| Foreign Keys tab | `Cmd+3`  |
| DDL tab          | `Cmd+4`  |

## Import/Export

| Action      | Shortcut      |
| ----------- | ------------- |
| Export data | `Cmd+Shift+E` |
| Import data | `Cmd+Shift+I` |

## Quick switcher

The Quick Switcher (`Cmd+Shift+O`) opens a floating panel to search and jump to any table, view, database, schema, saved query, or recent query. It uses fuzzy matching, so typing `usr` finds `users`, `user_settings`, etc. Matched characters are highlighted in each result.

| Action                                         | Shortcut             |
| ---------------------------------------------- | -------------------- |
| Open Quick Switcher                            | `Cmd+Shift+O`        |
| Navigate results                               | `Up` / `Down` arrows |
| Open selected item                             | `Return`             |
| Open in a new tab                              | `Option+Return`      |
| Switch scope (All, Tables, Databases, Queries) | `Cmd+1` to `Cmd+4`   |
| Dismiss                                        | `Escape`             |

Results are grouped by type (tables, views, system tables, databases, schemas, saved queries, recent queries) and ranked by match quality, how often you open each item, and how recently. Tables already open in a tab show an `Open` badge and rank higher; selecting one switches to the existing tab instead of opening a duplicate. Right-click a result for more actions: open the table structure, copy the name, or copy the query.

## Global Shortcuts

| Action           | Shortcut |
| ---------------- | -------- |
| Quit application | `Cmd+Q`  |
| Preferences      | `Cmd+,`  |

## Customizing Shortcuts

Most menu shortcuts are rebindable in **Settings** > **Keyboard**.

<Frame caption="Keyboard shortcut customization">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/settings-keyboard.png" alt="Keyboard settings" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/settings-keyboard-dark.png" alt="Keyboard settings" />
</Frame>

### Rebinding a Shortcut

1. Open **Settings** (`Cmd+,`) and select the **Keyboard** tab
2. Find the action (use the search field to filter)
3. Click the shortcut field next to the action
4. Press the new key combination
5. The shortcut updates immediately in the menu bar

<Note>
  Menu actions need a modifier key (`Cmd`, `Option`, `Control`, or `Shift`). A plain key like `Space` won't reach the menu, so TablePro asks you to add a modifier. The exceptions are function keys (`F1` through `F12`), which work on their own, and data grid actions that read the key directly, like Preview FK Reference (`Space`) and Cancel edit (`Escape`).
</Note>

### Clearing a Shortcut

1. Click the shortcut field for the action
2. Press `Delete` or `Backspace`
3. The shortcut is removed

### Conflict Detection

If you assign a shortcut already used by another action in the same context, TablePro shows a confirmation dialog naming that action and its group:

* **Cancel**: keep the existing assignment
* **Reassign**: move the shortcut to the new action (clears the previous action's shortcut)

The same key can mean different things in the editor and the data grid because focus decides which one fires, so a grid shortcut and an editor shortcut can share a key without conflicting.

<Warning>
  Shortcuts the editor uses internally (like `Cmd+/` to comment or `Cmd+Shift+K` to delete a line) and macOS system shortcuts (read live from System Settings, so `Cmd+Q`, Spotlight, and Mission Control are covered) cannot be assigned. TablePro warns if you try.
</Warning>

### Resetting to Defaults

A reset button (the curved arrow) appears next to any shortcut you have changed; click it to restore that one action. Click **Reset to Defaults** to restore every shortcut at once.

<Note>
  Tab switching shortcuts (`Cmd+1` through `Cmd+9`) follow standard macOS convention and cannot be customized.
</Note>

## Outside The App

TablePro can also be driven from outside the running app. None of these are macOS keyboard shortcuts in the strict sense, but they cover the same fast-navigation use cases.

| Entry point                                          | Use                                                                                                                                                               |
| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Raycast extension](/external-api/raycast)           | Trigger commands from Raycast's own hotkey: search connections, open tables, run queries, search query history, focus tabs.                                       |
| [`tablepro://` URL scheme](/external-api/url-scheme) | `open tablepro://...` from the terminal, browser, or another app to open a connection, table, or query tab. Bind in Raycast Quicklinks, Alfred, or Shortcuts.app. |
| [MCP clients](/external-api/mcp-clients)             | Claude Desktop, Cursor, Claude Code, Cline, Continue, Zed, Windsurf, Goose. Each client decides its own hotkey for invoking AI; tools call back into TablePro.    |
