Situation
I use VIM and IntelliJ on a daily basis, and I recently installed VS Code to try out the newest "Copilot Chat" features. To port over my keybindings, I installed the "IntelliJ IDEA Keybindings" extension. However, I encountered an issue where pressing the "Return" or "Enter" key brings up the "Find" input field and searches for the next occurrence, instead of performing the expected action of creating a new line.
Problem
I need to find a way to determine when and which command is triggered by a specific keyboard shortcut in VS Code. I have searched for solutions or extensions that could help me identify the command associated with a keyboard shortcut, but I haven’t found a suitable solution yet. Having this capability would make it easier for me to remap shortcuts and troubleshoot unexpected behavior.
Attempted Solution
Initially, I considered building an extension that would display the last triggered command’s name in the status bar at the bottom of the editor. However, I realized that this approach, though fun, might not be a practical use of my time, haha.
Request
I am seeking assistance in finding a solution to determine the command triggered by a keyboard shortcut in VS Code. Specifically, I would like to know if there is an existing extension or method that can display the name of the command triggered in the status bar. This information would greatly aid me in remapping shortcuts and understanding any unexpected behavior.
2
Answers
You can view all of the keyboard shortcuts from the
Preferences
menu option.Linux/Windows:
Ctrl + K Ctrl + S
Mac:
Command + K Command + S
.You can edit the key bindings here. You’ll also find detailed information in the official documentation on how to update or debug issues with keyboard shortcuts.
You can either
open the keyboard shortcut editor UI by using the
Preferences: Open Keyboard Shortcuts
command in the command palette, and then use the "Record Keys" button (bound to alt+k on Windows and Linux) to search for the keybinding of interest. Oropen your keybindings.json file and use the find widget (ctrl/cmd+f) to search for the keybinding sequence and see what command it’s bound to.
If that’s not bearing fruit, you can also use the tips in VS Code’s keybinding troubleshooting docs (and wiki): Use the
Developer: Toggle Keyboard Shortcuts Troubleshooting
command, which will cause event logs about keyboard shortcuts to be logged to the Output Panel.Here’s an example from the wiki:
where you can see it shows what keyboard events it receives, and what command it matches it to.