The Keybind Modes extension for Visual Studio Code allows you to create and manage custom keybinding modes. This enables you to switch between different sets of keybindings based on the active mode, providing a flexible and dynamic coding environment.
- Toggle Keybind Modes: Easily switch between different keybinding modes.
- Custom Keybindings: Define keybindings that are only active in specific modes.
- Status Bar Integration: Displays the current mode in the status bar.
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X. - Search for "Keybind Modes" and click Install.
- Download the
.vsixfile from the Releases page. - Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X). - Click on the
...(More Actions) button in the top-right corner. - Select
Install from VSIX...and choose the downloaded.vsixfile.
The extension is activated the first time a command is executed. It provides two main commands:
- Toggle Mode: Switches between the default mode and a custom mode.
- Clear Mode: Resets to the default mode.
To create a new keybinding mode, follow these steps:
-
Define the Mode:
In your
keybindings.json, define a keybinding that sets the mode using thekeybind-modes.togglecommand. For example:{ "key": "ctrl+alt+m", "command": "keybind-modes.toggle", "args": { "mode": "myCustomMode" } } -
Add Keybindings for the Mode:
Define keybindings that are only active when your custom mode is enabled. Use the
whenclause to specify the mode:{ "key": "n", "command": "workbench.action.files.newUntitledFile", "when": "mode == 'myCustomMode'" }
The current mode is displayed in the status bar, allowing you to quickly see which mode is active.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This extension is licensed under the MIT License.