-
Notifications
You must be signed in to change notification settings - Fork 585
customize shortcuts
The MSSQL extension supports two different mechanisms for keyboard shortcuts:
-
VS Code keybindings (
keybindings.json) — for Command Palette commands such as Execute Query, Connect, and Disconnect. These are standard VS Code keybindings that you configure through the Keyboard Shortcuts editor orkeybindings.json. -
Result view shortcuts (
mssql.shortcutsinsettings.json) — for actions inside the query results pane such as navigating grids, copying data, and saving results. These use the extension's own shortcut system and are configured as an extension setting.
If you're coming from SQL Server Management Studio (SSMS) or Azure Data Studio, install the MSSQL Database Management Keymap companion extension to get familiar shortcuts out of the box.

The extension provides the following key bindings:
| Function | Windows / Linux | macOS |
|---|---|---|
| Run query | F5 |
F5 |
| Run current statement | Ctrl+F5 |
Cmd+F5 |
| Open new SQL query editor | Ctrl+N |
Cmd+N |
| Show query results pane | Win+Shift+R |
Cmd+Shift+R |
| Show connection list | Ctrl+Shift+D |
Cmd+Shift+D |
| Show estimated plan | Ctrl+L |
Cmd+L |
| Toggle actual plan | Ctrl+M |
Cmd+M |
| Cancel running query | Alt+PauseBreak |
Option+PauseBreak |
Note: This keymap does not include user-customized key bindings from Azure Data Studio. Custom key bindings need to be configured manually in the MSSQL keyboard preferences settings, accessible from the Command Palette. This extension overrides some default VS Code shortcuts for database management scenarios.
You can install this extension from the migration dialog when transitioning from Azure Data Studio, or directly from the Visual Studio Code Marketplace.
To customize any MSSQL command shortcut:
- Open the Keyboard Shortcuts editor:
Cmd+K Cmd+S(macOS) orCtrl+K Ctrl+S(Windows/Linux). - Search for the command name (e.g.
mssql.newQuery). - Click the pencil icon next to the command and press the new key combination.
- Press
Enterto confirm.
Alternatively, you can edit keybindings.json directly (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux > Preferences: Open Keyboard Shortcuts (JSON)):
[
{
"key": "ctrl+shift+n",
"command": "mssql.newQuery",
"when": "editorTextFocus && editorLangId == 'sql'"
}
]Note: You may override the shortcut for another command. Choose a keybinding that doesn't conflict with existing shortcuts. You can check for conflicts in the Keyboard Shortcuts editor.
The extension provides several commands accessible from the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux). Here are the most commonly used commands and their default shortcuts:
| Command | Description | Windows/Linux | macOS |
|---|---|---|---|
MS SQL: Connect |
Connect to a SQL Server, Azure SQL, or SQL database in Fabric | Ctrl+Shift+C |
Cmd+Shift+C |
MS SQL: Disconnect |
Disconnect the current editor session | Ctrl+Shift+D |
Cmd+Shift+D |
MS SQL: Focus on Object Explorer |
Open the SQL Server Object Explorer view | Ctrl+Alt+D |
Cmd+Alt+D |
MS SQL: Execute Query |
Run a query for the current active SQL document | Ctrl+Shift+E |
Cmd+Shift+E |
MS SQL: Run Current Statement |
Execute only the T-SQL statement under the cursor | — | — |
MS SQL: Cancel Query |
Cancel the query execution in progress | — | — |
MS SQL: Use Database |
Switch to another database on the same server | — | — |
MS SQL: New Query |
Open a new SQL query file | — | — |
MS SQL: Manage Connection Profiles |
Create, edit, or remove connection profiles | — | — |
MS SQL: Create Container Group |
Set up a new SQL Server container locally | — | — |
MS SQL: Show Estimated Execution Plan |
View the estimated query execution plan | — | — |
Unlike the VS Code keybindings above, result view shortcuts are configured through the mssql.shortcuts extension setting in settings.json (not keybindings.json). These shortcuts apply only within the query results pane.
When customizing these shortcuts, use ctrlcmd to represent both Ctrl on Windows/Linux and Cmd on macOS (e.g. ctrlcmd+c maps to Ctrl+C on Windows/Linux and Cmd+C on macOS).
{
"mssql.shortcuts": {
// Query Results navigation
"event.queryResults.switchToResultsTab": "ctrl+alt+R",
"event.queryResults.switchToMessagesTab": "ctrl+alt+Y",
"event.queryResults.switchToQueryPlanTab": "ctrl+alt+E",
"event.queryResults.prevGrid": "ctrlcmd+up",
"event.queryResults.nextGrid": "ctrlcmd+down",
"event.queryResults.switchToTextView": "",
"event.queryResults.maximizeGrid": "",
"event.queryResults.saveAsJSON": "",
"event.queryResults.saveAsCSV": "",
"event.queryResults.saveAsExcel": "",
"event.queryResults.saveAsInsert": "",
// Result Grid actions
"event.resultGrid.copySelection": "ctrlcmd+c",
"event.resultGrid.copyWithHeaders": "",
"event.resultGrid.copyAllHeaders": "",
"event.resultGrid.selectAll": "ctrlcmd+a",
"event.resultGrid.copyAsCSV": "",
"event.resultGrid.copyAsJSON": "",
"event.resultGrid.copyAsInsert": "",
"event.resultGrid.copyAsInClause": "",
"event.resultGrid.changeColumnWidth": "alt+shift+s",
"event.resultGrid.expandSelectionLeft": "shift+left",
"event.resultGrid.expandSelectionRight": "shift+right",
"event.resultGrid.expandSelectionUp": "shift+up",
"event.resultGrid.expandSelectionDown": "shift+down",
"event.resultGrid.openColumnMenu": "f3",
"event.resultGrid.openFilterMenu": "",
"event.resultGrid.moveToRowStart": "ctrlcmd+left",
"event.resultGrid.moveToRowEnd": "ctrlcmd+right",
"event.resultGrid.selectColumn": "ctrl+space",
"event.resultGrid.selectRow": "shift+space",
"event.resultGrid.toggleSort": "alt+shift+o"
}
}| Shortcut Event | Default Binding | Description |
|---|---|---|
event.queryResults.switchToResultsTab |
Ctrl+Alt+R |
Switch to the Results tab |
event.queryResults.switchToMessagesTab |
Ctrl+Alt+Y |
Switch to the Messages tab |
event.queryResults.switchToQueryPlanTab |
Ctrl+Alt+E |
Switch to the Query Plan tab |
event.queryResults.prevGrid |
Ctrl/Cmd+Up |
Navigate to the previous result grid |
event.queryResults.nextGrid |
Ctrl/Cmd+Down |
Navigate to the next result grid |
event.queryResults.switchToTextView |
— | Switch results to text view |
event.queryResults.maximizeGrid |
— | Maximize/minimize the current grid |
event.queryResults.saveAsJSON |
— | Save results as JSON |
event.queryResults.saveAsCSV |
— | Save results as CSV |
event.queryResults.saveAsExcel |
— | Save results as Excel |
event.queryResults.saveAsInsert |
— | Save results as INSERT statements |
| Shortcut Event | Default Binding | Description |
|---|---|---|
event.resultGrid.copySelection |
Ctrl/Cmd+C |
Copy the current selection |
event.resultGrid.copyWithHeaders |
— | Copy selection with column headers |
event.resultGrid.copyAllHeaders |
— | Copy all column headers |
event.resultGrid.selectAll |
Ctrl/Cmd+A |
Select all data in the active grid |
event.resultGrid.copyAsCSV |
— | Copy selection as CSV |
event.resultGrid.copyAsJSON |
— | Copy selection as JSON |
event.resultGrid.copyAsInsert |
— | Copy selection as INSERT statements |
event.resultGrid.copyAsInClause |
— | Copy selection as an IN clause |
event.resultGrid.changeColumnWidth |
Alt+Shift+S |
Adjust column width |
event.resultGrid.expandSelectionLeft |
Shift+Left |
Expand selection to the left |
event.resultGrid.expandSelectionRight |
Shift+Right |
Expand selection to the right |
event.resultGrid.expandSelectionUp |
Shift+Up |
Expand selection upward |
event.resultGrid.expandSelectionDown |
Shift+Down |
Expand selection downward |
event.resultGrid.openColumnMenu |
F3 |
Open the column context menu |
event.resultGrid.openFilterMenu |
— | Open the filter menu |
event.resultGrid.moveToRowStart |
Ctrl/Cmd+Left |
Move to the start of the row |
event.resultGrid.moveToRowEnd |
Ctrl/Cmd+Right |
Move to the end of the row |
event.resultGrid.selectColumn |
Ctrl+Space |
Select the entire column |
event.resultGrid.selectRow |
Shift+Space |
Select the entire row |
event.resultGrid.toggleSort |
Alt+Shift+O |
Toggle sort on the current column |
- Customize Extension Options — configure all extension settings
- Manage Connection Profiles — create, edit, and remove connection profiles
Want to contribute to the MSSQL extension?
-
Discussions – Share feedback and discuss potential improvements.
-
Report bugs – Help us identify and fix issues.
-
Suggest new features – Propose enhancements and new capabilities.
- Home
- Roadmap
- Documentation
- Demo videos
- Blog posts
- Customize keyboard shortcuts
- Customize extension options
- Manage connection profiles
- Operating Systems
- Contributing
- Usage reporting
- Enable Integrated Authentication on macOS and Linux using Kerberos
- OpenSSL configuration (Mac Only)
- Pre-Windows 10 pre-requisite
- Troubleshooting
- Collecting logs
- Releases
- Changelog