Skip to content

Creating Language specific keybindings #34892

Discussion options

You must be logged in to vote

You can apply different keybinds for different contexts, which supports filtering on file extension. For example, here's an example from the default macOS keymap that applies SVG specific keybinds:

{
"context": "Editor && extension == svg",
"use_key_equivalents": true,
"bindings": {
"cmd-k v": "svg::OpenPreviewToTheSide",
"cmd-shift-v": "svg::OpenPreview"
}

To help debug your keybinds and see what context each key stroke matches, run the dev: Open Key Context View action.

Docs: https://zed.dev/docs/key-bindings#contexts

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by falboe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants