Keyboard shortcuts
VS Code keybindings for run, optimize, and favorites — plus @ mention shortcuts you type in the SQL editor to open command libraries, starred SQL, and query history.
Overview
SQLLens.AI shortcuts fall into two groups:
- Keybindings — Ctrl/⌘ chords bound to extension commands (run query, optimize, new file, …).
@mention shortcuts — type in the SQL editor (no chord); autocomplete opens a filtered list. Accept with Enter or Tab, dismiss with Esc.
Run Show MySQL Shortcuts (mysql.shortcuts.show) from the Command Palette to open the live list of keybindings. That list reflects your OS and any overrides in VS Code.
For the full autocomplete guide (all @ channels, JOIN ON, Query Builder tokens), see SQL autocomplete — @ mention channels.
@ mention shortcuts (SQL editor)
Type @ at the start of a line or after ;, then a channel keyword. Add words after the keyword to filter (for example @dba long). Channels are progressive: @f → @fa → @fav narrows as you type each letter.
| Shortcut | Aliases | What you get | Example filter |
|---|---|---|---|
@com | @command, @cmd, @sql, @c (MySQL/MariaDB; on PostgreSQL @c is psql \c, not commands) | Engine command library — session settings, metadata, maintenance templates | @com process → processlist-related commands |
@dba | (same catalog as @com) | DBA runbook commands — long queries, locks, processlist, diagnostics | @dba long → long-running query templates |
@fav | @favorite, @favorites, @f | Starred SQL from the Favorites panel (names and shortcut keys match) | @fav payroll → favorites matching “payroll” |
@fre | @frequent, @frequently | Most-run queries on this connection (by execution count) | @fre select → frequent SELECT templates |
- ↑ ↓ — move highlight in the list
- Enter or Tab — insert the selected row (replaces the whole
@…span) - Esc — close the list without inserting
- Keep typing after the channel word to fuzzy-filter labels
Slash variants at line start work the same way for favorites and history: /fav, /history (see slash shortcuts). /fre is not favorites — it maps to frequent queries.
Default keybindings
Below, ⌘ is macOS; on Windows and Linux use Ctrl instead (where the command names match).
| Action | Default | Command |
|---|---|---|
| Run statement under cursor | ⌘+↵ | mysql.runQuery |
| Run all in file | ⌘+Shift+↵ | mysql.runAll |
| Open Visual Explain | ⌘+Alt+O | mysql.optimize |
| New SQL file | ⌘+Alt+N | mysql.newSqlFile |
| Tree search | ⌘+P then db | mysql.treeSearch |
| Insert favorite | ⌘+K, F | mysql.favorite.insert |
Customizing
Open Preferences → Keyboard Shortcuts (⌘+K ⌘+S), search for the command id, and rebind. VS Code overrides take precedence over the defaults shipped with SQLLens.AI.